From: Sidharth Anupkrishnan Date: Wed, 29 Apr 2020 13:04:57 +0000 (+0530) Subject: qa/test_exports: fix TestExports failure under new python3 compability changes X-Git-Tag: v16.1.0~2375^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b98f3e388b6a38e91c2ee064466ae8f130a5bcda;p=ceph.git qa/test_exports: fix TestExports failure under new python3 compability changes 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 --- diff --git a/qa/tasks/cephfs/test_exports.py b/qa/tasks/cephfs/test_exports.py index c58ee7a1c90a..019c91c5a8c0 100644 --- a/qa/tasks/cephfs/test_exports.py +++ b/qa/tasks/cephfs/test_exports.py @@ -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): """