]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/pybind/rbd: fix read offset in write zeroes tests 60844/head
authorIlya Dryomov <idryomov@gmail.com>
Mon, 3 Mar 2025 16:59:35 +0000 (17:59 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 3 Mar 2025 20:31:07 +0000 (21:31 +0100)
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 <idryomov@gmail.com>
src/test/pybind/test_rbd.py

index ce4a1440453dea45f1f66b23bc28bc48531a494a..11b3b8f5e78738b49273aaeb0c35e607d063cf4e 100644 (file)
@@ -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]