]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/pybind/rbd: fix read offset in write zeroes tests 62129/head
authorIlya Dryomov <idryomov@gmail.com>
Mon, 3 Mar 2025 16:59:35 +0000 (17:59 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 7 Mar 2025 10:57:53 +0000 (11:57 +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>
(cherry picked from commit d41f0fa01f59a8d056dc28934b92212c78a05a62)

src/test/pybind/test_rbd.py

index 665f8569bbda830cfdd5d504770a0aa3c9b3d074..6339fd3f24814026ff4691ed0d237ad0b3a643c4 100644 (file)
@@ -683,14 +683,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):
@@ -1591,7 +1591,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]