mirror of
https://github.com/ceph/ceph
synced 2025-03-19 00:45:00 +00:00
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 <idryomov@gmail.com>
This commit is contained in:
parent
54f47cc28f
commit
d41f0fa01f
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user