Skip to content

Commit

Permalink
Revert "Revert rpm/deb changes pending decision" (#4341)
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Ho <dxho@amazon.com>
  • Loading branch information
derek-ho authored Jan 19, 2024
1 parent 5803531 commit 35955c4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
4 changes: 4 additions & 0 deletions src/test_workflow/integ_test/distribution_deb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 4 additions & 0 deletions src/test_workflow/integ_test/distribution_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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")
Expand Down

0 comments on commit 35955c4

Please sign in to comment.