From 35955c4a1d3d8b0c072f95101a472287c5a4af0d Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 19 Jan 2024 13:50:34 -0500 Subject: [PATCH] Revert "Revert rpm/deb changes pending decision" (#4341) Signed-off-by: Derek Ho --- src/test_workflow/integ_test/distribution_deb.py | 4 ++++ src/test_workflow/integ_test/distribution_rpm.py | 4 ++++ .../integ_test/test_distribution_deb.py | 16 +++++++++++----- .../integ_test/test_distribution_rpm.py | 16 +++++++++++----- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/test_workflow/integ_test/distribution_deb.py b/src/test_workflow/integ_test/distribution_deb.py index 06b14e7049..d49866a807 100644 --- a/src/test_workflow/integ_test/distribution_deb.py +++ b/src/test_workflow/integ_test/distribution_deb.py @@ -30,6 +30,10 @@ def install(self, bundle_name: str) -> None: logging.info("deb installation requires sudo, script will exit if current user does not have sudo access") deb_install_cmd = " ".join( [ + 'sudo', + 'env', + 'OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123!', + '&&', 'sudo', 'dpkg', '--purge', diff --git a/src/test_workflow/integ_test/distribution_rpm.py b/src/test_workflow/integ_test/distribution_rpm.py index 880074185d..17c3325480 100644 --- a/src/test_workflow/integ_test/distribution_rpm.py +++ b/src/test_workflow/integ_test/distribution_rpm.py @@ -30,6 +30,10 @@ def install(self, bundle_name: str) -> None: logging.info("rpm installation requires sudo, script will exit if current user does not have sudo access") rpm_install_cmd = " ".join( [ + 'sudo', + 'env', + 'OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123!', + '&&', 'sudo', 'yum', 'remove', diff --git a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_deb.py b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_deb.py index 3a4b7028a8..8a299bf72b 100644 --- a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_deb.py +++ b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_deb.py @@ -13,16 +13,14 @@ class TestDistributionDeb(unittest.TestCase): - def setUp(self) -> None: - self.work_dir = os.path.join(os.path.dirname(__file__), "data") self.distribution_deb = DistributionDeb("opensearch", "1.3.0", self.work_dir) self.distribution_deb_dashboards = DistributionDeb("opensearch-dashboards", "1.3.0", self.work_dir) def test_distribution_deb_vars(self) -> None: - self.assertEqual(self.distribution_deb.filename, 'opensearch') - self.assertEqual(self.distribution_deb.version, '1.3.0') + self.assertEqual(self.distribution_deb.filename, "opensearch") + self.assertEqual(self.distribution_deb.version, "1.3.0") self.assertEqual(self.distribution_deb.work_dir, self.work_dir) self.assertEqual(self.distribution_deb.require_sudo, True) @@ -40,7 +38,15 @@ def test_install(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"sudo dpkg --purge opensearch && sudo dpkg --install opensearch.deb && sudo chmod 0666 {self.distribution_deb.config_path}", args_list[0][0][0]) + self.assertEqual( + ( + "sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123! && " + "sudo dpkg --purge opensearch && " + "sudo dpkg --install opensearch.deb && " + f"sudo chmod 0666 {self.distribution_deb.config_path}" + ), + args_list[0][0][0], + ) def test_start_cmd(self) -> None: self.assertEqual(self.distribution_deb.start_cmd, "sudo systemctl start opensearch") diff --git a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_rpm.py b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_rpm.py index 19de5d2f2e..508d954c4f 100644 --- a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_rpm.py +++ b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_distribution_rpm.py @@ -13,16 +13,14 @@ class TestDistributionRpm(unittest.TestCase): - def setUp(self) -> None: - self.work_dir = os.path.join(os.path.dirname(__file__), "data") self.distribution_rpm = DistributionRpm("opensearch", "1.3.0", self.work_dir) self.distribution_rpm_dashboards = DistributionRpm("opensearch-dashboards", "1.3.0", self.work_dir) def test_distribution_rpm_vars(self) -> None: - self.assertEqual(self.distribution_rpm.filename, 'opensearch') - self.assertEqual(self.distribution_rpm.version, '1.3.0') + self.assertEqual(self.distribution_rpm.filename, "opensearch") + self.assertEqual(self.distribution_rpm.version, "1.3.0") self.assertEqual(self.distribution_rpm.work_dir, self.work_dir) self.assertEqual(self.distribution_rpm.require_sudo, True) @@ -40,7 +38,15 @@ def test_install(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"sudo yum remove -y opensearch && sudo yum install -y opensearch.rpm && sudo chmod 0666 {self.distribution_rpm.config_path}", args_list[0][0][0]) + self.assertEqual( + ( + "sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123! && " + "sudo yum remove -y opensearch && " + "sudo yum install -y opensearch.rpm && " + f"sudo chmod 0666 {self.distribution_rpm.config_path}" + ), + args_list[0][0][0], + ) def test_start_cmd(self) -> None: self.assertEqual(self.distribution_rpm.start_cmd, "sudo systemctl start opensearch")