From ef159854c2ebefdb96a0257cf6cd8eb61c7271ff Mon Sep 17 00:00:00 2001 From: Lucas Wizer da Silva Date: Thu, 2 Oct 2025 13:52:49 -0300 Subject: [PATCH] Regenarate index file containing package charts after helm file delete Change-Id: I97a68c3b557b223df7bfbecd309154455679f6ec Signed-off-by: Lucas Wizer da Silva --- keywords/cloud_platform/helm/helm_keywords.py | 23 +++++++++++++------ .../sanity/test_sanity_regression.py | 2 ++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/keywords/cloud_platform/helm/helm_keywords.py b/keywords/cloud_platform/helm/helm_keywords.py index b67f1b6b..d25a140c 100644 --- a/keywords/cloud_platform/helm/helm_keywords.py +++ b/keywords/cloud_platform/helm/helm_keywords.py @@ -15,20 +15,29 @@ class HelmKeywords(BaseKeyword): def helm_upload(self, repo_name: str, helm_file: str): """ Runs the helm-upload command - Args: - repo_name (): the name of the repo ex. starlingx - helm_file (): the helm tar file - Returns: + Args: + repo_name (str): the name of the repo ex. starlingx + helm_file (str): the helm tar file """ - # setup expected prompts for password request password_prompt = PromptResponse("assword", ConfigurationManager.get_lab_config().get_admin_credentials().get_password()) password_completed = PromptResponse("@") expected_prompts = [password_prompt, password_completed] - output_list = self.ssh_connection.send_expect_prompts(f'helm-upload {repo_name} {helm_file}', expected_prompts) + output_list = self.ssh_connection.send_expect_prompts(f"helm-upload {repo_name} {helm_file}", expected_prompts) # At this time the this will only fail. Once we have a passing test we can check if there are better assertion values - assert not any('Error' in output for output in output_list), f"There was an error running the command helm-upload {repo_name} {helm_file}" + assert not any("Error" in output for output in output_list), f"There was an error running the command helm-upload {repo_name} {helm_file}" + + def helm_repo_index(self, dir_path: str): + """ + Runs the helm repo index command + + Args: + dir_path (str): the name of the repo ex. /var/www/pages/helm_charts/starlingx/ + + """ + self.ssh_connection.send_as_sudo(f"helm repo index {dir_path}") + self.validate_success_return_code(self.ssh_connection) diff --git a/testcases/cloud_platform/sanity/test_sanity_regression.py b/testcases/cloud_platform/sanity/test_sanity_regression.py index 6e4a3ac6..848b5a9a 100644 --- a/testcases/cloud_platform/sanity/test_sanity_regression.py +++ b/testcases/cloud_platform/sanity/test_sanity_regression.py @@ -250,6 +250,7 @@ def test_upload_charts_via_helm_upload_simplex(): file_keywords = FileKeywords(ssh_connection) if file_keywords.file_exists(f"{helm_chart_location}/{helm_file}"): file_keywords.delete_file(f"{helm_chart_location}/{helm_file}") + HelmKeywords(ssh_connection).helm_repo_index(f"{helm_chart_location}") # upload file to lab file_keywords.upload_file(get_stx_resource_path(f"resources/cloud_platform/containers/{helm_file}"), f"/home/sysadmin/{helm_file}", overwrite=True) @@ -283,6 +284,7 @@ def test_upload_charts_via_helm_upload_standby_controller(request): file_keywords = FileKeywords(ssh_connection) if file_keywords.file_exists(f"{helm_chart_location}/{helm_file}"): file_keywords.delete_file(f"{helm_chart_location}/{helm_file}") + HelmKeywords(ssh_connection).helm_repo_index(f"{helm_chart_location}") # upload file to lab file_keywords.upload_file(get_stx_resource_path(f"resources/cloud_platform/containers/{helm_file}"), f"/home/sysadmin/{helm_file}", overwrite=True)