]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/test_exports: fix TestExports failure under new python3 compability changes
authorSidharth Anupkrishnan <sanupkri@redhat.com>
Wed, 29 Apr 2020 13:04:57 +0000 (18:34 +0530)
committerRamana Raja <rraja@redhat.com>
Thu, 11 Jun 2020 08:15:25 +0000 (13:45 +0530)
self.mount_a.client_remote.sh() returns an 'str' object rather than a StringIO object. Hence the p.stdout.getvalue() produces an error. This commit fixes this and also fix str and byte mismatch as byte and string were the same object in Python2 but this is not the case in Python3.

Signed-off-by: Sidharth Anupkrishnan <sanupkri@redhat.com>
(cherry picked from commit b98f3e388b6a38e91c2ee064466ae8f130a5bcda)

qa/tasks/cephfs/test_exports.py

index c58ee7a1c90a16d3d1437f4c0676210409f55546..019c91c5a8c0bdea89328d17c008755c19218df2 100644 (file)
@@ -131,12 +131,12 @@ class TestExports(CephFSTestCase):
             p = self.mount_a.client_remote.sh('uname -r', wait=True)
             dir_pin = self.mount_a.getfattr("1", "ceph.dir.pin")
             log.debug("mount.getfattr('1','ceph.dir.pin'): %s " % dir_pin)
-            if str(p.stdout.getvalue()) < "5" and not(dir_pin):
+            if str(p) < "5" and not(dir_pin):
                 self.skipTest("Kernel does not support getting the extended attribute ceph.dir.pin")
-        self.assertTrue(self.mount_a.getfattr("1", "ceph.dir.pin") == "1")
-        self.assertTrue(self.mount_a.getfattr("1/2", "ceph.dir.pin") == "0")
+        self.assertEqual(self.mount_a.getfattr("1", "ceph.dir.pin"), b'1')
+        self.assertEqual(self.mount_a.getfattr("1/2", "ceph.dir.pin"), b'0')
         if (len(self.fs.get_active_names()) > 2):
-            self.assertTrue(self.mount_a.getfattr("1/2/3", "ceph.dir.pin") == "2")
+            self.assertEqual(self.mount_a.getfattr("1/2/3", "ceph.dir.pin"), b'2')
 
     def test_session_race(self):
         """