From: Kefu Chai Date: Tue, 22 Oct 2019 04:44:35 +0000 (+0800) Subject: test/pybind/test_rados: always pass bytes to rados.Object.set_xattr() X-Git-Tag: v15.1.0~1189^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b9f7a6534bc41e6c0851c6ddc27256fd711bcc7f;p=ceph-ci.git test/pybind/test_rados: always pass bytes to rados.Object.set_xattr() > an empty '' is of type str, not bytes. python3 says. so let's be more explicit. this change address failures like: ``` ====================================================================== ERROR: test_rados.TestIoctx.test_obj_xattrs ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python3/dist-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/var/ssd/ceph/src/test/pybind/test_rados.py", line 380, in test_obj_xattrs obj.set_xattr(key, value) File "rados.pyx", line 4119, in rados.set_object_locator.retfunc File "rados.pyx", line 4129, in rados.set_object_namespace.retfunc File "rados.pyx", line 4204, in rados.Object.set_xattr File "rados.pyx", line 572, in rados.requires.wrapper.validate_func File "rados.pyx", line 560, in rados.requires.check_type TypeError: xattr_value must be bytes ``` Signed-off-by: Kefu Chai --- diff --git a/src/test/pybind/test_rados.py b/src/test/pybind/test_rados.py index 967fc0adae5..bd685b3c617 100644 --- a/src/test/pybind/test_rados.py +++ b/src/test/pybind/test_rados.py @@ -362,7 +362,7 @@ class TestIoctx(object): ('ns1', 'ns1-c'), ('ns1', 'ns1-d')]) def test_xattrs(self): - xattrs = dict(a=b'1', b=b'2', c=b'3', d=b'a\0b', e=b'\0', f='') + xattrs = dict(a=b'1', b=b'2', c=b'3', d=b'a\0b', e=b'\0', f=b'') self.ioctx.write('abc', b'') for key, value in xattrs.items(): self.ioctx.set_xattr('abc', key, value) @@ -373,7 +373,7 @@ class TestIoctx(object): eq(stored_xattrs, xattrs) def test_obj_xattrs(self): - xattrs = dict(a=b'1', b=b'2', c=b'3', d=b'a\0b', e=b'\0', f='') + xattrs = dict(a=b'1', b=b'2', c=b'3', d=b'a\0b', e=b'\0', f=b'') self.ioctx.write('abc', b'') obj = list(self.ioctx.list_objects())[0] for key, value in xattrs.items():