]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: Fix a few mgr/volume test cases
authorKotresh HR <khiremat@redhat.com>
Fri, 5 Feb 2021 18:05:22 +0000 (23:35 +0530)
committerKotresh HR <khiremat@redhat.com>
Fri, 5 Mar 2021 06:50:32 +0000 (12:20 +0530)
Recovering dirty auth metadata file might not retain the order,
fixed the comparison in 'test_recover_auth_metadata_during_authorize'
and 'test_recover_auth_metadata_during_deauthorize'.

Fixes: https://tracker.ceph.com/issues/49192
Signed-off-by: Kotresh HR <khiremat@redhat.com>
(cherry picked from commit 4952d2132ffd92594e749a652970d5d9415c721d)

qa/tasks/cephfs/test_volumes.py

index bcd2f27cc7c82ed822e181d043d87340bbdd9721..cd9b35d3417cf2c760614b3c74686693f146780e 100644 (file)
@@ -1422,7 +1422,7 @@ class TestVolumes(CephFSTestCase):
         # list authorized-ids of the subvolume
         expected_auth_list = [{'alice': 'rw'}, {'guest1': 'rw'}, {'guest2': 'r'}]
         auth_list = json.loads(self._fs_cmd('subvolume', 'authorized_list', self.volname, subvolume, "--group_name", group))
-        self.assertListEqual(auth_list, expected_auth_list)
+        self.assertCountEqual(expected_auth_list, auth_list)
 
         # cleanup
         self._fs_cmd("subvolume", "deauthorize", self.volname, subvolume, authid1,
@@ -1607,7 +1607,7 @@ class TestVolumes(CephFSTestCase):
         # created on authorizing 'guest1' access to the subvolume.
         auth_metadata_filename = "${0}.meta".format(guestclient_1["auth_id"])
         self.assertIn(auth_metadata_filename, guest_mount.ls("volumes"))
-        expected_auth_metadata_content = self.mount_a.run_shell(['cat', 'volumes/{0}'.format(auth_metadata_filename)]).stdout.getvalue().strip()
+        expected_auth_metadata_content = self._auth_metadata_get(self.mount_a.read_file("volumes/{0}".format(auth_metadata_filename)))
 
         # Induce partial auth update state by modifying the auth metadata file,
         # and then run authorize again.
@@ -1617,7 +1617,7 @@ class TestVolumes(CephFSTestCase):
         self._fs_cmd("subvolume", "authorize", self.volname, subvolume, guestclient_1["auth_id"],
                      "--group_name", group, "--tenant_id", guestclient_1["tenant_id"])
 
-        auth_metadata_content = self.mount_a.run_shell(['cat', 'volumes/{0}'.format(auth_metadata_filename)]).stdout.getvalue().strip()
+        auth_metadata_content = self._auth_metadata_get(self.mount_a.read_file("volumes/{0}".format(auth_metadata_filename)))
         self.assertEqual(auth_metadata_content, expected_auth_metadata_content)
 
         # clean up
@@ -1659,7 +1659,7 @@ class TestVolumes(CephFSTestCase):
         # created on authorizing 'guest1' access to the subvolume1.
         auth_metadata_filename = "${0}.meta".format(guestclient_1["auth_id"])
         self.assertIn(auth_metadata_filename, guest_mount.ls("volumes"))
-        expected_auth_metadata_content = self.mount_a.run_shell(['cat', 'volumes/{0}'.format(auth_metadata_filename)]).stdout.getvalue().strip()
+        expected_auth_metadata_content = self._auth_metadata_get(self.mount_a.read_file("volumes/{0}".format(auth_metadata_filename)))
 
         # Authorize 'guestclient_1' to access the subvolume2.
         self._fs_cmd("subvolume", "authorize", self.volname, subvolume2, guestclient_1["auth_id"],
@@ -1673,7 +1673,7 @@ class TestVolumes(CephFSTestCase):
         self._fs_cmd("subvolume", "deauthorize", self.volname, subvolume2, guestclient_1["auth_id"],
                      "--group_name", group)
 
-        auth_metadata_content = self.mount_a.run_shell(['cat', 'volumes/{0}'.format(auth_metadata_filename)]).stdout.getvalue().strip()
+        auth_metadata_content = self._auth_metadata_get(self.mount_a.read_file("volumes/{0}".format(auth_metadata_filename)))
         self.assertEqual(auth_metadata_content, expected_auth_metadata_content)
 
         # clean up