]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa: fix output check to not be sensitive to debugging
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 10 Dec 2019 23:08:41 +0000 (15:08 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 11 Dec 2019 00:45:09 +0000 (16:45 -0800)
The traceback would screw up the equality checks.

Also, use unittest asserts so we can easily see the assert values.

Fixes: https://tracker.ceph.com/issues/43247
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
qa/tasks/cephfs/test_cephfs_shell.py

index d0b67c3ad2aaf4466f97d6f418100421841b4bce..527301bbfad775a60515d4c84de7299677d56d3b 100644 (file)
@@ -334,43 +334,40 @@ class TestSnapshots(TestCephFSShell):
         # create the snapshot - must pass
         o = self.get_cephfs_shell_cmd_output("snap create snap1 /data_dir")
         log.info("cephfs-shell output:\n{}".format(o))
-        assert(o == "")
+        self.assertEqual("", o)
         o = self.mount_a.stat(sdn)
         log.info("mount_a output:\n{}".format(o))
-        assert(('st_mode' in str(o)) == True)
+        self.assertIn('st_mode', o)
 
         # create the same snapshot again - must fail with an error message
         o = self.get_cephfs_shell_cmd_error("snap create snap1 /data_dir")
         log.info("cephfs-shell output:\n{}".format(o))
-        o = o.split('\n')
-        assert(o[0] == "ERROR: snapshot 'snap1' already exists")
+        self.assertIn("snapshot 'snap1' already exists", o)
         o = self.mount_a.stat(sdn)
         log.info("mount_a output:\n{}".format(o))
-        assert(('st_mode' in str(o)) == True)
+        self.assertIn('st_mode', o)
 
         # delete the snapshot - must pass
         o = self.get_cephfs_shell_cmd_output("snap delete snap1 /data_dir")
         log.info("cephfs-shell output:\n{}".format(o))
-        assert(o == "")
+        self.assertEqual("", o)
         try:
             o = self.mount_a.stat(sdn)
         except:
             # snap dir should not exist anymore
             pass
         log.info("mount_a output:\n{}".format(o))
-        assert(('st_mode' in str(o)) == False)
+        self.assertNotIn('st_mode', o)
 
         # delete the same snapshot again - must fail with an error message
         o = self.get_cephfs_shell_cmd_error("snap delete snap1 /data_dir")
-        o = o.strip()
-        o = o.split('\n')
-        assert(o[0] == "ERROR: 'snap1': no such snapshot")
+        self.assertIn("'snap1': no such snapshot", o)
         try:
             o = self.mount_a.stat(sdn)
         except:
             pass
         log.info("mount_a output:\n{}".format(o))
-        assert(('st_mode' in str(o)) == False)
+        self.assertNotIn('st_mode', o)
 
 class TestCD(TestCephFSShell):
     CLIENTS_REQUIRED = 1
@@ -740,7 +737,6 @@ class TestMisc(TestCephFSShell):
         log.info("output:\n{}".format(o))
 
 class TestConfReading(TestCephFSShell):
-
     def test_reading_conf_opt(self):
         """
         Read conf without duplicate sections/options.