From d41f0fa01f59a8d056dc28934b92212c78a05a62 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Mon, 3 Mar 2025 17:59:35 +0100 Subject: [PATCH] test/pybind/rbd: fix read offset in write zeroes tests Random data is written and write zeroes is invoked on 0~256, but the read is done on 256~256. This means that if write zeroes malfunctions the test wouldn't catch it (especially in the thick provision case). Signed-off-by: Ilya Dryomov --- src/test/pybind/test_rbd.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/pybind/test_rbd.py b/src/test/pybind/test_rbd.py index ce4a1440453..11b3b8f5e78 100644 --- a/src/test/pybind/test_rbd.py +++ b/src/test/pybind/test_rbd.py @@ -694,14 +694,14 @@ class TestImage(object): data = rand_data(256) self.image.write(data, 0) self.image.write_zeroes(0, 256) - eq(self.image.read(256, 256), b'\0' * 256) + eq(self.image.read(0, 256), b'\0' * 256) check_diff(self.image, 0, IMG_SIZE, None, 0, []) def test_write_zeroes_thick_provision(self): data = rand_data(256) self.image.write(data, 0) self.image.write_zeroes(0, 256, RBD_WRITE_ZEROES_FLAG_THICK_PROVISION) - eq(self.image.read(256, 256), b'\0' * 256) + eq(self.image.read(0, 256), b'\0' * 256) check_diff(self.image, 0, IMG_SIZE, None, 0, [(0, 256, True)]) def test_read(self): @@ -1604,7 +1604,7 @@ class TestImage(object): eq(retval[0], 0) eq(comp.get_return_value(), 0) eq(sys.getrefcount(comp), 2) - eq(self.image.read(256, 256), b'\0' * 256) + eq(self.image.read(0, 256), b'\0' * 256) def test_aio_flush(self): retval = [None]