From bb8f7b0907a2557f4ef5b0455c0fce66aa896e4b Mon Sep 17 00:00:00 2001 From: Sidharth Anupkrishnan Date: Wed, 29 Apr 2020 18:34:57 +0530 Subject: [PATCH] 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) --- qa/tasks/cephfs/test_exports.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qa/tasks/cephfs/test_exports.py b/qa/tasks/cephfs/test_exports.py index 060131add70f..6757f9dd908d 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): """ -- 2.47.3