diff --git a/src/test_workflow/integ_test/distribution.py b/src/test_workflow/integ_test/distribution.py index d535edb6e3..93fbb35efa 100644 --- a/src/test_workflow/integ_test/distribution.py +++ b/src/test_workflow/integ_test/distribution.py @@ -41,6 +41,13 @@ def config_path(self) -> str: """ pass + @property + def log_dir(self) -> str: + """ + Return the log directory for the distribution + """ + pass + @abstractmethod def install(self, bundle_name: str) -> None: """ diff --git a/src/test_workflow/integ_test/distribution_deb.py b/src/test_workflow/integ_test/distribution_deb.py index 125219d5ec..dbaf0dec24 100644 --- a/src/test_workflow/integ_test/distribution_deb.py +++ b/src/test_workflow/integ_test/distribution_deb.py @@ -25,6 +25,10 @@ def install_dir(self) -> str: def config_path(self) -> str: return os.path.join(os.sep, "etc", self.filename, self.config_filename) + @property + def log_dir(self) -> str: + return os.path.join(os.sep, "var", "log", self.filename) + def install(self, bundle_name: str) -> None: logging.info(f"Installing {bundle_name} in {self.install_dir}") logging.info("deb installation requires sudo, script will exit if current user does not have sudo access") @@ -42,7 +46,9 @@ def install(self, bundle_name: str) -> None: '--install', bundle_name, '&&', - f'sudo chmod 0666 {self.config_path}' + f'sudo chmod 0666 {self.config_path}', + '&&', + f'sudo chmod 0755 {os.path.dirname(self.config_path)} {self.log_dir}' ] ) subprocess.check_call(deb_install_cmd, cwd=self.work_dir, shell=True) diff --git a/src/test_workflow/integ_test/distribution_rpm.py b/src/test_workflow/integ_test/distribution_rpm.py index 8cd5c84572..9b8a6b4bc9 100644 --- a/src/test_workflow/integ_test/distribution_rpm.py +++ b/src/test_workflow/integ_test/distribution_rpm.py @@ -25,6 +25,10 @@ def install_dir(self) -> str: def config_path(self) -> str: return os.path.join(os.sep, "etc", self.filename, self.config_filename) + @property + def log_dir(self) -> str: + return os.path.join(os.sep, "var", "log", self.filename) + def install(self, bundle_name: str) -> None: logging.info(f"Installing {bundle_name} in {self.install_dir}") logging.info("rpm installation requires sudo, script will exit if current user does not have sudo access") @@ -44,7 +48,9 @@ def install(self, bundle_name: str) -> None: '-y', bundle_name, '&&', - f'sudo chmod 0666 {self.config_path}' + f'sudo chmod 0666 {self.config_path}', + '&&', + f'sudo chmod 0755 {os.path.dirname(self.config_path)} {self.log_dir}' ] ) subprocess.check_call(rpm_install_cmd, cwd=self.work_dir, shell=True) diff --git a/src/test_workflow/integ_test/distribution_tar.py b/src/test_workflow/integ_test/distribution_tar.py index 4c8ed65336..e99ee34e40 100644 --- a/src/test_workflow/integ_test/distribution_tar.py +++ b/src/test_workflow/integ_test/distribution_tar.py @@ -25,6 +25,10 @@ def install_dir(self) -> str: def config_path(self) -> str: return os.path.join(self.install_dir, "config", self.config_filename) + @property + def log_dir(self) -> str: + return os.path.join(self.install_dir, "logs") + def install(self, bundle_name: str) -> None: logging.info(f"Installing {bundle_name} in {self.install_dir}") with tarfile.open(bundle_name, 'r:gz') as bundle_tar: diff --git a/src/test_workflow/integ_test/distribution_zip.py b/src/test_workflow/integ_test/distribution_zip.py index 2e56184934..12991891a4 100644 --- a/src/test_workflow/integ_test/distribution_zip.py +++ b/src/test_workflow/integ_test/distribution_zip.py @@ -25,6 +25,10 @@ def install_dir(self) -> str: def config_path(self) -> str: return os.path.join(self.install_dir, "config", self.config_filename) + @property + def log_dir(self) -> str: + return os.path.join(self.install_dir, "logs") + def install(self, bundle_name: str) -> None: logging.info(f"Installing {bundle_name} in {self.install_dir}") with ZipFile(bundle_name, "r") as zip: 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 67e31311f4..5c87f57b2b 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 @@ -43,7 +43,8 @@ def test_install(self, check_call_mock: Mock) -> None: "sudo dpkg --purge opensearch && " "sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123! " "dpkg --install opensearch.deb && " - f"sudo chmod 0666 {self.distribution_deb.config_path}" + f"sudo chmod 0666 {self.distribution_deb.config_path} && " + "sudo chmod 0755 /etc/opensearch /var/log/opensearch" ), args_list[0][0][0], ) 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 79c90d64c6..3fac943d17 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 @@ -43,7 +43,8 @@ def test_install(self, check_call_mock: Mock) -> None: "sudo yum remove -y opensearch && " "sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123! " "yum install -y opensearch.rpm && " - f"sudo chmod 0666 {self.distribution_rpm.config_path}" + f"sudo chmod 0666 {self.distribution_rpm.config_path} && " + "sudo chmod 0755 /etc/opensearch /var/log/opensearch" ), args_list[0][0][0], )