]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/pybind/rbd: fix tests that compare strings with b''
authorIlya Dryomov <idryomov@gmail.com>
Tue, 4 Jun 2024 19:19:40 +0000 (21:19 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 5 Jun 2024 06:42:14 +0000 (08:42 +0200)
assert_not_equal(b'', self.image.id()) is bogus because Image::id()
returns a string (str), not bytes.  If the types don't match, values
are guaranteed to not match.

The same goes for Image::block_name_prefix().

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/test/pybind/test_rbd.py

index 0040d1e67e5b82e00f7aacbe011634e02c0105bd..629ad84aec4c7d4cd442a214d5fb53491d054edf 100644 (file)
@@ -624,10 +624,14 @@ class TestImage(object):
 
     @require_new_format()
     def test_id(self):
-        assert_not_equal(b'', self.image.id())
+        id = self.image.id()
+        assert isinstance(id, str)
+        assert len(id) > 0
 
     def test_block_name_prefix(self):
-        assert_not_equal(b'', self.image.block_name_prefix())
+        block_name_prefix = self.image.block_name_prefix()
+        assert isinstance(block_name_prefix, str)
+        assert len(block_name_prefix) > 0
 
     def test_data_pool_id(self):
         assert_greater_equal(self.image.data_pool_id(), 0)