]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test_cephfs_shell: test du with no args
authorRishabh Dave <ridave@redhat.com>
Tue, 20 Aug 2019 22:01:55 +0000 (03:31 +0530)
committerRishabh Dave <ridave@redhat.com>
Fri, 13 Sep 2019 05:15:39 +0000 (10:45 +0530)
Signed-off-by: Rishabh Dave <ridave@redhat.com>
qa/tasks/cephfs/test_cephfs_shell.py

index 6697f3cff858ee16fc30bf5c70ca2db1545124e0..d5f858b086610c36eaf7c89c9706ee2e859e1dff 100644 (file)
@@ -540,6 +540,22 @@ class TestDU(TestCephFSShell):
                        "expected_output -\n{}\ndu_output -\n{}\n".format(
                        expected_output, du_output)
 
+    def test_du_with_no_args(self):
+        expected_patterns_in_output = self._setup_files()
+
+        du_output = self.get_cephfs_shell_cmd_output('du')
+
+        for expected_output in expected_patterns_in_output:
+            # Since CWD is CephFS root and being non-recursive expect only
+            # CWD in DU report.
+            if expected_output.find('/') == len(expected_output) - 1:
+                if sys_version_info.major >= 3:
+                    self.assertRegex(expected_output, du_output)
+                elif sys_version_info.major < 3:
+                    assert re_search(expected_output, du_output) != None, "\n" + \
+                        "expected_output -\n{}\ndu_output -\n{}\n".format(
+                        expected_output, du_output)
+
 #    def test_ls(self):
 #        """
 #        Test that ls passes