]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test_cephfs_shell: add a test for cd with no arguments
authorRishabh Dave <ridave@redhat.com>
Thu, 27 Jun 2019 13:42:52 +0000 (19:12 +0530)
committerRishabh Dave <ridave@redhat.com>
Thu, 25 Jul 2019 05:21:50 +0000 (10:51 +0530)
Add a method to test that the cd command changes the current working
directory to root when no argument is passed.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
qa/tasks/cephfs/test_cephfs_shell.py

index 86810fc295d7bcc2d00db71086b97ac9137e06c5..335fe41104ea33179d1769aa47d73d532eeb9a73 100644 (file)
@@ -264,6 +264,22 @@ class TestGetAndPut(TestCephFSShell):
         log.info("o_hash:{}".format(o_hash))
         assert(s_hash == o_hash)
 
+class TestCD(TestCephFSShell):
+    CLIENTS_REQUIRED = 1
+
+    def test_cd_with_no_args(self):
+        """
+        Test that when cd is issued without any arguments, CWD is changed
+        to root directory.
+        """
+        path = 'dir1/dir2/dir3'
+        self.mount_a.run_shell('mkdir -p ' + path)
+        expected_cwd = '/'
+
+        script = 'cd {}\ncd\ncwd\n'.format(path)
+        output = self.get_cephfs_shell_script_output(script)
+        self.assertEqual(output, expected_cwd)
+
 #    def test_ls(self):
 #        """
 #        Test that ls passes