]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa: added testcase to check get cmd doesn't create subdirs on its own
authordparmar18 <dparmar@redhat.com>
Tue, 19 Apr 2022 11:28:11 +0000 (16:58 +0530)
committerdparmar18 <dparmar@redhat.com>
Wed, 11 May 2022 11:46:28 +0000 (17:16 +0530)
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
qa/tasks/cephfs/test_cephfs_shell.py

index e2b86bef989851b2b670d631e23bab9116a26090..71084816630936059d9cec37adbe2a71b8c4f841 100644 (file)
@@ -378,6 +378,19 @@ class TestGetAndPut(TestCephFSShell):
         # NOTE: following command must run successfully.
         self.mount_a.run_shell('stat dump5', cwd=None)
 
+    def test_get_doesnt_create_dir(self):
+        # if get cmd is creating subdirs on its own then dump7 will be
+        # stored as ./dump7/tmp/dump7 and not ./dump7, therefore
+        # if doing `cat ./dump7` returns non-zero exit code(i.e. 1) then
+        # it implies that no such file exists at that location
+        dir_abspath = path.join(self.mount_a.mountpoint, 'tmp')
+        self.mount_a.run_shell_payload(f"mkdir {dir_abspath}")
+        self.mount_a.client_remote.write_file(path.join(dir_abspath, 'dump7'),
+                                              'somedata')
+        self.get_cephfs_shell_cmd_output("get /tmp/dump7 ./dump7")
+        # test that dump7 exists
+        self.mount_a.run_shell("cat ./dump7", cwd=None)
+
     def test_get_to_console(self):
         """
         Test that get passes with target name