diff --git a/src/system/process.py b/src/system/process.py index 49ba7d0975..286b7d8d56 100644 --- a/src/system/process.py +++ b/src/system/process.py @@ -12,12 +12,14 @@ class Process: - def __init__(self) -> None: + def __init__(self, filename: str, distribution: str) -> None: self.process: subprocess.Popen[bytes] = None self.stdout: Any = None self.stderr: Any = None self.__stdout_data__: str = None self.__stderr_data__: str = None + self.filename = filename + self.distribution = distribution def start(self, command: str, cwd: str) -> None: if self.started: @@ -38,7 +40,7 @@ def terminate(self) -> int: if not self.started: raise ProcessNotStartedError() - parent = psutil.Process(self.process.pid) + parent = psutil.Process(self.pid) logging.debug("Checking for child processes") child_processes = parent.children(recursive=True) for child in child_processes: @@ -65,6 +67,10 @@ def terminate(self) -> int: self.return_code = self.process.returncode self.process = None + if self.distribution == "rpm": + logging.info("Clean up process related files for packages") + subprocess.check_call(f"yum remove -y '{self.filename}*'", shell=True) + return self.return_code @property @@ -73,6 +79,8 @@ def started(self) -> bool: @property def pid(self) -> int: + if self.distribution == "rpm": + return int(subprocess.check_output(f"sleep 1 && systemctl show --property MainPID {self.filename}", encoding='UTF-8', shell=True).split("=")[1]) if self.started else None return self.process.pid if self.started else None @property diff --git a/src/test_workflow/README.md b/src/test_workflow/README.md index 340af02799..36e807f847 100644 --- a/src/test_workflow/README.md +++ b/src/test_workflow/README.md @@ -69,6 +69,14 @@ To run OpenSearch Dashboards integration tests. opensearch-dashboards=https://ci.opensearch.org/ci/dbc/bundle-build-dashboards/1.2.0/869/linux/x64 ``` +To run OpenSearch Dashboards integration tests with local artifacts on different distributions +```bash +./test.sh integ-test manifests/2.0.0/opensearch-dashboards-2.0.0-test.yml --paths opensearch=tar opensearch-dashboards=tar +./test.sh integ-test manifests/2.0.0/opensearch-dashboards-2.0.0-test.yml --paths opensearch=rpm opensearch-dashboards=rpm +``` + +:warning: RPM Test requires user to run the `./test.sh` command with sudo permission, as rpm requires root to install and start the service. + ### Backwards Compatibility Tests Runs backward compatibility invoking `run_bwc_test.py` in each component from a distribution manifest. diff --git a/src/test_workflow/integ_test/local_test_cluster.py b/src/test_workflow/integ_test/local_test_cluster.py index 35b7306798..8ef08db331 100644 --- a/src/test_workflow/integ_test/local_test_cluster.py +++ b/src/test_workflow/integ_test/local_test_cluster.py @@ -39,7 +39,9 @@ def __init__( self.dependency_installer = dependency_installer self.service_opensearch = ServiceOpenSearch( + self.manifest.build.filename, self.manifest.build.version, + self.manifest.build.distribution if self.manifest.build.distribution else 'tar', self.additional_cluster_config, self.security_enabled, self.dependency_installer, diff --git a/src/test_workflow/integ_test/local_test_cluster_opensearch_dashboards.py b/src/test_workflow/integ_test/local_test_cluster_opensearch_dashboards.py index 4ec5097403..6e15566799 100644 --- a/src/test_workflow/integ_test/local_test_cluster_opensearch_dashboards.py +++ b/src/test_workflow/integ_test/local_test_cluster_opensearch_dashboards.py @@ -44,16 +44,18 @@ def __init__( self.dependency_installer_opensearch_dashboards = dependency_installer_opensearch_dashboards self.service_opensearch = ServiceOpenSearch( + self.manifest_opensearch.build.filename, self.manifest_opensearch.build.version, + self.manifest_opensearch.build.distribution, {}, self.security_enabled, self.dependency_installer_opensearch, self.work_dir) - build = self.manifest_opensearch_dashboards.build - self.service_opensearch_dashboards = ServiceOpenSearchDashboards( - build.version, + self.manifest_opensearch_dashboards.build.filename, + self.manifest_opensearch_dashboards.build.version, + self.manifest_opensearch_dashboards.build.distribution, self.additional_cluster_config, self.security_enabled, self.dependency_installer_opensearch_dashboards, diff --git a/src/test_workflow/integ_test/service.py b/src/test_workflow/integ_test/service.py index 41a2708034..ba7678f2e9 100644 --- a/src/test_workflow/integ_test/service.py +++ b/src/test_workflow/integ_test/service.py @@ -6,6 +6,7 @@ import abc import logging +import os import time import requests @@ -19,14 +20,30 @@ class Service(abc.ABC): Abstract base class for all types of test clusters. """ - def __init__(self, work_dir, version, security_enabled, additional_config, dependency_installer): + def __init__(self, work_dir, filename, version, distribution, security_enabled, additional_config, dependency_installer): + self.filename = filename self.work_dir = work_dir self.version = version + self.distribution = distribution self.security_enabled = security_enabled self.additional_config = additional_config self.dependency_installer = dependency_installer - self.process_handler = Process() + self.process_handler = Process(self.filename, self.distribution) + self.install_dir_map = { + "tar": os.path.join(self.work_dir, f"{self.filename}-{self.version}"), + "rpm": os.path.join(os.sep, "usr", "share", self.filename) + } + self.config_file_map = { + "tar": os.path.join(self.install_dir_map[self.distribution], "config", f"{self.filename.replace('-', '_')}.yml"), + "rpm": os.path.join(os.sep, "etc", self.filename, f"{self.filename.replace('-', '_')}.yml") + } + self.start_cmd_map = { + "tar-opensearch": "./opensearch-tar-install.sh", + "tar-opensearch-dashboards": "./opensearch-dashboards", + "rpm-opensearch": "systemctl start opensearch", + "rpm-opensearch-dashboards": "systemctl start opensearch-dashboards" + } self.install_dir = "" @abc.abstractmethod diff --git a/src/test_workflow/integ_test/service_opensearch.py b/src/test_workflow/integ_test/service_opensearch.py index 4f3ec7386c..710156c41b 100644 --- a/src/test_workflow/integ_test/service_opensearch.py +++ b/src/test_workflow/integ_test/service_opensearch.py @@ -6,6 +6,7 @@ import logging import os +import subprocess import tarfile import requests @@ -17,22 +18,27 @@ class ServiceOpenSearch(Service): def __init__( self, + filename, version, + distribution, additional_config, security_enabled, dependency_installer, work_dir ): - super().__init__(work_dir, version, security_enabled, additional_config, dependency_installer) + super().__init__(work_dir, filename, version, distribution, security_enabled, additional_config, dependency_installer) self.dependency_installer = dependency_installer + self.filename = filename + self.distribution = distribution - self.install_dir = os.path.join(self.work_dir, f"opensearch-{self.version}") + logging.info(f'{self.filename} distribution: {self.distribution}') + self.install_dir = self.install_dir_map[self.distribution] def start(self): self.__download() - self.opensearch_yml_dir = os.path.join(self.install_dir, "config", "opensearch.yml") + self.opensearch_yml_dir = self.config_file_map[self.distribution] self.security_plugin_dir = os.path.join(self.install_dir, "plugins", "opensearch-security") if not self.security_enabled and os.path.isdir(self.security_plugin_dir): @@ -41,7 +47,7 @@ def start(self): if self.additional_config: self.__add_plugin_specific_config(self.additional_config) - self.process_handler.start("./opensearch-tar-install.sh", self.install_dir) + self.process_handler.start(self.start_cmd_map[f"{self.distribution}-{self.filename}"], self.install_dir) logging.info(f"Started OpenSearch with parent PID {self.process_handler.pid}") def __download(self): @@ -50,11 +56,31 @@ def __download(self): bundle_name = self.dependency_installer.download_dist(self.work_dir) logging.info(f"Downloaded bundle to {os.path.realpath(bundle_name)}") - logging.info(f"Unpacking {bundle_name}") - with tarfile.open(bundle_name, 'r') as bundle_tar: - bundle_tar.extractall(self.work_dir) - - logging.info(f"Unpacked {bundle_name}") + logging.info(f"Installing {bundle_name} in {self.install_dir}") + + if self.distribution == "tar": + with tarfile.open(bundle_name, 'r') as bundle_tar: + bundle_tar.extractall(self.work_dir) + elif self.distribution == "rpm": + logging.info("rpm installation requires sudo, script will exit if current user does not have sudo access") + rpm_install_cmd = " ".join( + [ + 'yum', + 'remove', + '-y', + self.filename, + '&&', + 'yum', + 'install', + '-y', + bundle_name + ] + ) + subprocess.check_call(rpm_install_cmd, cwd=self.work_dir, shell=True) + else: + raise(f'{self.distribution} is not supported in integ-test yet') + + logging.info(f"Installed {bundle_name}") def url(self, path=""): return f'{"https" if self.security_enabled else "http"}://{self.endpoint()}:{self.port()}{path}' diff --git a/src/test_workflow/integ_test/service_opensearch_dashboards.py b/src/test_workflow/integ_test/service_opensearch_dashboards.py index 7e9744ff55..cbcb14bd69 100644 --- a/src/test_workflow/integ_test/service_opensearch_dashboards.py +++ b/src/test_workflow/integ_test/service_opensearch_dashboards.py @@ -18,20 +18,26 @@ class ServiceOpenSearchDashboards(Service): def __init__( self, + filename, version, + distribution, additional_config, security_enabled, dependency_installer, work_dir ): - super().__init__(work_dir, version, security_enabled, additional_config, dependency_installer) - self.install_dir = os.path.join(self.work_dir, f"opensearch-dashboards-{self.version}") + super().__init__(work_dir, filename, version, distribution, security_enabled, additional_config, dependency_installer) + self.filename = filename + self.distribution = distribution + + logging.info(f'{self.filename} distribution: {self.distribution}') + self.install_dir = self.install_dir_map[self.distribution] def start(self): logging.info(f"Starting OpenSearch Dashboards service from {self.work_dir}") self.__download() - self.opensearch_dashboards_yml_dir = os.path.join(self.install_dir, "config", "opensearch_dashboards.yml") + self.opensearch_dashboards_yml_dir = self.config_file_map[self.distribution] self.executable_dir = os.path.join(self.install_dir, "bin") if not self.security_enabled: @@ -42,7 +48,7 @@ def start(self): if self.additional_config: self.__add_plugin_specific_config(self.additional_config) - self.process_handler.start("./opensearch-dashboards", self.executable_dir) + self.process_handler.start(self.start_cmd_map[f"{self.distribution}-{self.filename}"], self.executable_dir) logging.info(f"Started OpenSearch Dashboards with parent PID {self.process_handler.pid}") def __set_logging_dest(self): @@ -53,7 +59,7 @@ def __set_logging_dest(self): def __remove_security(self): self.security_plugin_dir = os.path.join(self.install_dir, "plugins", "securityDashboards") if os.path.isdir(self.security_plugin_dir): - subprocess.check_call("./opensearch-dashboards-plugin remove securityDashboards", cwd=self.executable_dir, shell=True) + subprocess.check_call("./opensearch-dashboards-plugin remove --allow-root securityDashboards", cwd=self.executable_dir, shell=True) with open(self.opensearch_dashboards_yml_dir, "w") as yamlfile: yamlfile.close() @@ -63,11 +69,31 @@ def __download(self): bundle_name = self.dependency_installer.download_dist(self.work_dir) logging.info(f"Downloaded bundle to {os.path.realpath(bundle_name)}") - logging.info(f"Unpacking {bundle_name}") - with tarfile.open(bundle_name, 'r') as bundle_tar: - bundle_tar.extractall(self.work_dir) - - logging.info(f"Unpacked {bundle_name}") + logging.info(f"Installing {bundle_name} in {self.install_dir}") + + if self.distribution == "tar": + with tarfile.open(bundle_name, 'r') as bundle_tar: + bundle_tar.extractall(self.work_dir) + elif self.distribution == "rpm": + logging.info("rpm installation requires sudo, script will exit if current user does not have sudo access") + rpm_install_cmd = " ".join( + [ + 'yum', + 'remove', + '-y', + self.filename, + '&&', + 'yum', + 'install', + '-y', + bundle_name + ] + ) + subprocess.check_call(rpm_install_cmd, cwd=self.work_dir, shell=True) + else: + raise(f'{self.distribution} is not supported in integ-test yet') + + logging.info(f"Installed {bundle_name}") def url(self, path=""): return f'http://{self.endpoint()}:{self.port()}{path}' diff --git a/tests/tests_system/test_process.py b/tests/tests_system/test_process.py index ab9b32a12f..d57086efbe 100644 --- a/tests/tests_system/test_process.py +++ b/tests/tests_system/test_process.py @@ -14,7 +14,30 @@ class TestProcess(unittest.TestCase): def test(self) -> None: - process_handler = Process() + process_handler = Process("opensearch", "tar") + + process_handler.start("./tests/tests_system/data/wait_for_input.sh", ".") + + self.assertTrue(process_handler.started) + self.assertIsNotNone(process_handler.pid) + self.assertIsNotNone(process_handler.stdout_data) + self.assertIsNotNone(process_handler.stderr_data) + + return_code = process_handler.terminate() + + self.assertIsNone(return_code) + self.assertIsNotNone(process_handler.stdout_data) + self.assertIsNotNone(process_handler.stderr_data) + + self.assertFalse(process_handler.started) + self.assertIsNone(process_handler.pid) + + @patch('psutil.Process') + @patch('subprocess.check_output', return_value="MainPID=123") + @patch('subprocess.check_call', return_code=0) + def test_repm_pid(self, mock_subprocess_check_call: MagicMock, mock_subprocess_check_output: MagicMock, mock_psutil_process: MagicMock) -> None: + + process_handler = Process("opensearch", "rpm") process_handler.start("./tests/tests_system/data/wait_for_input.sh", ".") @@ -34,12 +57,12 @@ def test(self) -> None: @patch.object(tempfile, 'NamedTemporaryFile') def test_file_open_mode(self, mock_tempfile: MagicMock) -> None: - process_handler = Process() + process_handler = Process("opensearch", "tar") process_handler.start("./tests/tests_system/data/wait_for_input.sh", ".") mock_tempfile.assert_has_calls([call(mode="r+"), call(mode="r+")]) def test_start_twice(self) -> None: - process_handler = Process() + process_handler = Process("opensearch", "tar") process_handler.start("ls", ".") with self.assertRaises(ProcessStartedError) as ctx: @@ -48,7 +71,7 @@ def test_start_twice(self) -> None: self.assertTrue(str(ctx.exception).startswith("Process already started, pid: ")) def test_terminate_unstarted_process(self) -> None: - process_handler = Process() + process_handler = Process("opensearch", "tar") with self.assertRaises(ProcessNotStartedError) as ctx: process_handler.terminate() diff --git a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_local_test_cluster.py b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_local_test_cluster.py index 339107e92a..18767f278e 100644 --- a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_local_test_cluster.py +++ b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_local_test_cluster.py @@ -17,7 +17,9 @@ class LocalTestClusterTests(unittest.TestCase): def setUp(self): mock_manifest = MagicMock() + mock_manifest.build.filename = "opensearch" mock_manifest.build.version = "1.1.0" + mock_manifest.build.distribution = "tar" self.manifest = mock_manifest self.work_dir = "test_work_dir" @@ -53,7 +55,9 @@ def test_start(self, mock_service): cluster.start() mock_service.assert_called_once_with( + "opensearch", "1.1.0", + "tar", self.additional_cluster_config, self.security_enabled, self.dependency_installer, diff --git a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_local_test_cluster_opensearch_dashboards.py b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_local_test_cluster_opensearch_dashboards.py index 335ca34f70..7a558429cc 100644 --- a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_local_test_cluster_opensearch_dashboards.py +++ b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_local_test_cluster_opensearch_dashboards.py @@ -17,11 +17,15 @@ class LocalTestClusterOpenSearchDashboardsTests(unittest.TestCase): def setUp(self): mock_bundle_manifest_opensearch = MagicMock() + mock_bundle_manifest_opensearch.build.filename = "opensearch" mock_bundle_manifest_opensearch.build.version = "1.1.0" + mock_bundle_manifest_opensearch.build.distribution = "tar" self.mock_bundle_manifest_opensearch = mock_bundle_manifest_opensearch mock_bundle_manifest_opensearch_dashboards = MagicMock() + mock_bundle_manifest_opensearch_dashboards.build.filename = "opensearch-dashboards" mock_bundle_manifest_opensearch_dashboards.build.version = "1.1.0" + mock_bundle_manifest_opensearch_dashboards.build.distribution = "tar" self.mock_bundle_manifest_opensearch_dashboards = mock_bundle_manifest_opensearch_dashboards dependency_installer_opensearch = MagicMock() @@ -69,7 +73,9 @@ def test_start(self, mock_service_opensearch_dashboards, mock_service_opensearch cluster.start() mock_service_opensearch.assert_called_once_with( + "opensearch", "1.1.0", + "tar", {}, self.security_enabled, self.dependency_installer_opensearch, @@ -80,7 +86,9 @@ def test_start(self, mock_service_opensearch_dashboards, mock_service_opensearch mock_service_opensearch_object.wait_for_service.assert_called_once() mock_service_opensearch_dashboards.assert_called_once_with( + "opensearch-dashboards", "1.1.0", + "tar", self.additional_cluster_config, self.security_enabled, self.dependency_installer_opensearch_dashboards, diff --git a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_service_opensearch.py b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_service_opensearch.py index f6dfa07973..75bba91fe0 100644 --- a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_service_opensearch.py +++ b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_service_opensearch.py @@ -16,7 +16,9 @@ class ServiceOpenSearchTests(unittest.TestCase): def setUp(self): + self.filename = "opensearch" self.version = "1.1.0" + self.distribution = "tar" self.work_dir = "test_work_dir" self.additional_config = {"script.context.field.max_compilations_rate": "1000/1m"} self.dependency_installer = "" @@ -32,7 +34,9 @@ def test_start(self, mock_tarfile_open, mock_dump, mock_file, mock_pid, mock_pro dependency_installer = MagicMock() service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, dependency_installer, @@ -75,7 +79,9 @@ def test_start_security_disabled(self, mock_tarfile_open, mock_dump, mock_file, dependency_installer = MagicMock() service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, False, dependency_installer, @@ -124,7 +130,9 @@ def test_start_security_disabled_and_not_installed(self, mock_tarfile_open, mock dependency_installer = MagicMock() service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, False, dependency_installer, @@ -173,7 +181,9 @@ def test_terminate( mock_process_terminate ): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -193,7 +203,9 @@ def test_terminate( @patch('test_workflow.integ_test.service.Process.started', new_callable=PropertyMock, return_value=False) def test_terminate_process_not_started(self, mock_process_started, mock_process_terminate): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -207,7 +219,9 @@ def test_terminate_process_not_started(self, mock_process_started, mock_process_ def test_endpoint_port(self): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -219,7 +233,9 @@ def test_endpoint_port(self): def test_url_security_enabled(self): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -230,7 +246,9 @@ def test_url_security_enabled(self): def test_url_security_disabled(self): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, False, self.dependency_installer, @@ -243,7 +261,9 @@ def test_url_security_disabled(self): @patch.object(ServiceOpenSearch, "url") def test_get_service_response(self, mock_url, mock_requests_get): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -266,7 +286,9 @@ def test_get_service_response(self, mock_url, mock_requests_get): @patch('test_workflow.integ_test.service.Process.stderr_data', new_callable=PropertyMock, return_value="test stderr_data") def test_wait_for_service_succeed_on_first_attemp(self, mock_process_stderr_data, mock_process_stdout_data, mock_service_alive, mock_time_sleep): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -292,7 +314,9 @@ def test_wait_for_service_always_fail_without_exception( mock_time_sleep ): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -322,7 +346,9 @@ def test_wait_for_service_always_fail_with_exception( ): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -354,7 +380,9 @@ def test_wait_for_service_suceed_on_third_attempt( mock_time_sleep ): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -371,7 +399,9 @@ def test_wait_for_service_suceed_on_third_attempt( @patch.object(ServiceOpenSearch, "get_service_response") def test_service_alive_green_available(self, mock_get_service_response): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -390,7 +420,9 @@ def test_service_alive_green_available(self, mock_get_service_response): @patch.object(ServiceOpenSearch, "get_service_response") def test_service_alive_yellow_available(self, mock_get_service_response): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -409,7 +441,9 @@ def test_service_alive_yellow_available(self, mock_get_service_response): @patch.object(ServiceOpenSearch, "get_service_response") def test_service_alive_red_unavailable(self, mock_get_service_response): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -428,7 +462,9 @@ def test_service_alive_red_unavailable(self, mock_get_service_response): @patch.object(ServiceOpenSearch, "get_service_response") def test_service_alive_unavailable(self, mock_get_service_response): service = ServiceOpenSearch( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, diff --git a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_service_opensearch_dashboards.py b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_service_opensearch_dashboards.py index 6a48cb6632..02a6dcdfa2 100644 --- a/tests/tests_test_workflow/test_integ_workflow/integ_test/test_service_opensearch_dashboards.py +++ b/tests/tests_test_workflow/test_integ_workflow/integ_test/test_service_opensearch_dashboards.py @@ -14,7 +14,9 @@ class ServiceOpenSearchDashboardsTests(unittest.TestCase): def setUp(self): + self.filename = "opensearch-dashboards" self.version = "1.1.0" + self.distribution = "tar" self.work_dir = "test_work_dir" self.additional_config = {"script.context.field.max_compilations_rate": "1000/1m"} self.dependency_installer = "" @@ -29,7 +31,9 @@ def test_start(self, mock_tarfile_open, mock_dump, mock_file, mock_pid, mock_pro mock_dependency_installer = MagicMock() service = ServiceOpenSearchDashboards( + self.filename, self.version, + self.distribution, self.additional_config, True, mock_dependency_installer, @@ -76,7 +80,9 @@ def test_start_without_security(self, mock_tarfile_open, mock_dump, mock_file, m mock_dependency_installer = MagicMock() service = ServiceOpenSearchDashboards( + self.filename, self.version, + self.distribution, {}, False, mock_dependency_installer, @@ -109,7 +115,7 @@ def test_start_without_security(self, mock_tarfile_open, mock_dump, mock_file, m ) mock_check_call.assert_called_once_with( - "./opensearch-dashboards-plugin remove securityDashboards", + "./opensearch-dashboards-plugin remove --allow-root securityDashboards", cwd=os.path.join("test_work_dir", "opensearch-dashboards-1.1.0", "bin"), shell=True ) @@ -132,7 +138,9 @@ def test_start_without_security_and_not_installed(self, mock_tarfile_open, mock_ mock_dependency_installer = MagicMock() service = ServiceOpenSearchDashboards( + self.filename, self.version, + self.distribution, {}, False, mock_dependency_installer, @@ -174,7 +182,9 @@ def test_start_without_security_and_not_installed(self, mock_tarfile_open, mock_ def test_endpoint_port_url(self): service = ServiceOpenSearchDashboards( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -189,7 +199,9 @@ def test_endpoint_port_url(self): @patch.object(ServiceOpenSearchDashboards, "url") def test_get_service_response_with_security(self, mock_url, mock_requests_get): service = ServiceOpenSearchDashboards( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -208,7 +220,9 @@ def test_get_service_response_with_security(self, mock_url, mock_requests_get): @patch.object(ServiceOpenSearchDashboards, "url") def test_get_service_response_without_security(self, mock_url, mock_requests_get): service = ServiceOpenSearchDashboards( + self.filename, self.version, + self.distribution, self.additional_config, False, self.dependency_installer, @@ -226,7 +240,9 @@ def test_get_service_response_without_security(self, mock_url, mock_requests_get @patch.object(ServiceOpenSearchDashboards, "get_service_response") def test_service_alive_green_available(self, mock_get_service_response): service = ServiceOpenSearchDashboards( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -245,7 +261,9 @@ def test_service_alive_green_available(self, mock_get_service_response): @patch.object(ServiceOpenSearchDashboards, "get_service_response") def test_service_alive_yellow_available(self, mock_get_service_response): service = ServiceOpenSearchDashboards( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer, @@ -264,7 +282,9 @@ def test_service_alive_yellow_available(self, mock_get_service_response): @patch.object(ServiceOpenSearchDashboards, "get_service_response") def test_service_alive_red_unavailable(self, mock_get_service_response): service = ServiceOpenSearchDashboards( + self.filename, self.version, + self.distribution, self.additional_config, True, self.dependency_installer,