summaryrefslogtreecommitdiffstats
path: root/src/test/pybind/test_rados.py
diff options
context:
space:
mode:
authorWang Chao <sean10reborn@gmail.com>2024-08-13 15:34:12 +0200
committerWang Chao <sean10reborn@gmail.com>2024-11-05 17:17:19 +0100
commit3a27c3e58fca96d0f0c80a1d264cb3f5f156f5c3 (patch)
tree9604b2ce90d9acbeb2cbb0fa51435d142b0303e5 /src/test/pybind/test_rados.py
parentpybind/rados: fix the incorrect order of offset,length in WriteOp.zero (diff)
downloadceph-3a27c3e58fca96d0f0c80a1d264cb3f5f156f5c3.tar.xz
ceph-3a27c3e58fca96d0f0c80a1d264cb3f5f156f5c3.zip
test/pybind/test_rados.py: add test for reversed arguments offset,length in WriteOp.zero
Before the fix, zero(0, 2) would have no effect, and read would get '12345' instead of the expected '\x00\x00345'. Signed-off-by: Wang Chao <sean10reborn@gmail.com>
Diffstat (limited to 'src/test/pybind/test_rados.py')
-rw-r--r--src/test/pybind/test_rados.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/pybind/test_rados.py b/src/test/pybind/test_rados.py
index cb2a4f96101..0288527c4f9 100644
--- a/src/test/pybind/test_rados.py
+++ b/src/test/pybind/test_rados.py
@@ -516,6 +516,11 @@ class TestIoctx(object):
eq(self.ioctx.read('write_ops'), b'12\x00\x005')
write_op.write_full(b'12345')
+ write_op.zero(0, 2)
+ self.ioctx.operate_write_op(write_op, "write_ops")
+ eq(self.ioctx.read('write_ops'), b'\x00\x00345')
+
+ write_op.write_full(b'12345')
write_op.truncate(2)
self.ioctx.operate_write_op(write_op, "write_ops")
eq(self.ioctx.read('write_ops'), b'12')