From a26e7900f81aac546398200d7b64a262375f7478 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 15 Sep 2023 02:04:17 +0000 Subject: [PATCH] Make sure WindowsZip/LinuxTar remove correct dir when uninstall Signed-off-by: Peter Zhu --- src/test_workflow/integ_test/distribution_tar.py | 4 ++-- src/test_workflow/integ_test/distribution_zip.py | 4 ++-- .../test_integ_workflow/integ_test/test_distribution_tar.py | 2 +- .../test_integ_workflow/integ_test/test_distribution_zip.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/test_workflow/integ_test/distribution_tar.py b/src/test_workflow/integ_test/distribution_tar.py index 308c89819c..d3317d1263 100644 --- a/src/test_workflow/integ_test/distribution_tar.py +++ b/src/test_workflow/integ_test/distribution_tar.py @@ -39,5 +39,5 @@ def start_cmd(self) -> str: return start_cmd_map[self.filename] def uninstall(self) -> None: - logging.info(f"Cleanup {self.work_dir}/* content after the test") - subprocess.check_call(f"rm -rf {self.work_dir}/*", shell=True) + logging.info(f"Cleanup {self.install_dir} content after the test") + subprocess.check_call(f"rm -rf {self.install_dir}", shell=True) diff --git a/src/test_workflow/integ_test/distribution_zip.py b/src/test_workflow/integ_test/distribution_zip.py index a554d4fe5f..ad3c2c09ba 100644 --- a/src/test_workflow/integ_test/distribution_zip.py +++ b/src/test_workflow/integ_test/distribution_zip.py @@ -39,5 +39,5 @@ def start_cmd(self) -> str: return start_cmd_map[self.filename] def uninstall(self) -> None: - logging.info(f"Cleanup {self.work_dir}/* content after the test") - subprocess.check_call(f"rm -rf {self.work_dir}/*", shell=True) + logging.info(f"Cleanup {self.install_dir} content after the test") + subprocess.check_call(f"rm -rf {self.install_dir}", shell=True) diff --git a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_tar.py b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_tar.py index f0449e3f85..ee37616abb 100644 --- a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_tar.py +++ b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_tar.py @@ -54,4 +54,4 @@ def test_uninstall(self, check_call_mock: Mock) -> None: args_list = check_call_mock.call_args_list self.assertEqual(check_call_mock.call_count, 1) - self.assertEqual(f"rm -rf {self.work_dir}/*", args_list[0][0][0]) + self.assertEqual(f"rm -rf {self.work_dir}/opensearch-1.3.0", args_list[0][0][0]) diff --git a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_zip.py b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_zip.py index 5e7b155579..df44da6705 100644 --- a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_zip.py +++ b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_zip.py @@ -55,7 +55,7 @@ def test_uninstall(self, check_call_mock: Mock) -> None: args_list = check_call_mock.call_args_list self.assertEqual(check_call_mock.call_count, 1) - self.assertEqual(f"rm -rf {self.work_dir}/*", args_list[0][0][0]) + self.assertEqual(f"rm -rf {self.work_dir}/opensearch-2.4.0", args_list[0][0][0]) class TestDistributionZipOpenSearchDashboards(unittest.TestCase): @@ -97,4 +97,4 @@ def test_uninstall(self, check_call_mock: Mock) -> None: args_list = check_call_mock.call_args_list self.assertEqual(check_call_mock.call_count, 1) - self.assertEqual(f"rm -rf {self.work_dir}/*", args_list[0][0][0]) + self.assertEqual(f"rm -rf {self.work_dir}/opensearch-dashboards-2.4.0", args_list[0][0][0])