Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add condition for OSD integ tests on deb and rpm #4770

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/test_workflow/integ_test/distribution_deb.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def install(self, bundle_name: str) -> None:
'--install',
bundle_name,
'&&',
f'sudo chmod 0666 {self.config_path} {os.path.dirname(self.config_path)}/jvm.options',
f'sudo chmod 0666 {self.config_path} {os.path.dirname(self.config_path)}/jvm.options'
if self.filename == "opensearch" else f'sudo chmod 0666 {self.config_path}',
'&&',
f'sudo chmod 0755 {os.path.dirname(self.config_path)} {self.log_dir}',
'&&',
Expand Down
3 changes: 2 additions & 1 deletion src/test_workflow/integ_test/distribution_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def install(self, bundle_name: str) -> None:
'-y',
bundle_name,
'&&',
f'sudo chmod 0666 {self.config_path} {os.path.dirname(self.config_path)}/jvm.options',
f'sudo chmod 0666 {self.config_path} {os.path.dirname(self.config_path)}/jvm.options'
if self.filename == "opensearch" else f'sudo chmod 0666 {self.config_path}',
'&&',
f'sudo chmod 0755 {os.path.dirname(self.config_path)} {self.log_dir}',
'&&',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ def test_install(self, check_call_mock: Mock) -> None:
args_list[0][0][0],
)

@patch("subprocess.check_call")
def test_install_opensearch_dashboards(self, check_call_mock: Mock) -> None:
self.distribution_deb_dashboards.install("opensearch-dashboards.deb")
args_list = check_call_mock.call_args_list

self.assertEqual(check_call_mock.call_count, 1)
self.assertEqual(
(
"sudo dpkg --purge opensearch-dashboards && "
"sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123! "
"dpkg --install opensearch-dashboards.deb && "
f"sudo chmod 0666 {self.distribution_deb_dashboards.config_path} && "
f"sudo chmod 0755 {os.path.dirname(self.distribution_deb_dashboards.config_path)} {self.distribution_deb_dashboards.log_dir} && "
f"sudo usermod -a -G opensearch-dashboards `whoami` && "
f"sudo usermod -a -G adm `whoami`"
),
args_list[0][0][0],
)

def test_start_cmd(self) -> None:
self.assertEqual(self.distribution_deb.start_cmd, "sudo systemctl start opensearch")
self.assertEqual(self.distribution_deb_dashboards.start_cmd, "sudo systemctl start opensearch-dashboards")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ def test_install(self, check_call_mock: Mock) -> None:
args_list[0][0][0],
)

@patch("subprocess.check_call")
def test_install_opensearch_dashboards(self, check_call_mock: Mock) -> None:
self.distribution_rpm_dashboards.install("opensearch-dashboards.rpm")
args_list = check_call_mock.call_args_list

self.assertEqual(check_call_mock.call_count, 1)
self.assertEqual(
(
"sudo yum remove -y opensearch-dashboards && "
"sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123! "
"yum install -y opensearch-dashboards.rpm && "
f"sudo chmod 0666 {self.distribution_rpm_dashboards.config_path} && "
f"sudo chmod 0755 {os.path.dirname(self.distribution_rpm_dashboards.config_path)} {self.distribution_rpm_dashboards.log_dir} && "
f"sudo usermod -a -G opensearch-dashboards `whoami` && "
f"sudo usermod -a -G adm `whoami`"
),
args_list[0][0][0],
)

def test_start_cmd(self) -> None:
self.assertEqual(self.distribution_rpm.start_cmd, "sudo systemctl start opensearch")
self.assertEqual(self.distribution_rpm_dashboards.start_cmd, "sudo systemctl start opensearch-dashboards")
Expand Down
Loading