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 <sanupkri@redhat.com>
This commit is contained in:
Sidharth Anupkrishnan 2020-04-29 18:34:57 +05:30
parent c7d602929a
commit b98f3e388b

View 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):
"""