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: v15.2.4~42^2~93 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bb8f7b0907a2557f4ef5b0455c0fce66aa896e4b;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 (cherry picked from commit b98f3e388b6a38e91c2ee064466ae8f130a5bcda) --- diff --git a/qa/tasks/cephfs/test_exports.py b/qa/tasks/cephfs/test_exports.py index 060131add70..6757f9dd908 100644 --- a/qa/tasks/cephfs/test_exports.py +++ b/qa/tasks/cephfs/test_exports.py @@ -132,12 +132,12 @@ class TestExports(CephFSTestCase): p = self.mount_a.client_remote.run(args=['uname', '-r'], stdout=StringIO(), 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): """