From 34c16e954dccd0087962840e52d208f311c435a4 Mon Sep 17 00:00:00 2001 From: Zelin Hao Date: Wed, 21 Aug 2024 14:42:51 -0700 Subject: [PATCH] Update python tests Signed-off-by: Zelin Hao --- .../test_test_report_runner_dashboards.py | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/tests/tests_report_workflow/test_test_report_runner_dashboards.py b/tests/tests_report_workflow/test_test_report_runner_dashboards.py index c0f6b4646d..1598e7dc42 100644 --- a/tests/tests_report_workflow/test_test_report_runner_dashboards.py +++ b/tests/tests_report_workflow/test_test_report_runner_dashboards.py @@ -72,7 +72,10 @@ def test_ci_group(self, report_args_mock: MagicMock) -> None: test_report_runner_data = test_report_runner.update_data() self.assertEqual(len(test_report_runner_data["components"]), 9) - self.assertEqual(test_report_runner_data["components"][0]["name"], "OpenSearch-Dashboards-ci-group-1") + for i in range(3): + self.assertEqual(test_report_runner_data["components"][i]["name"], f"OpenSearch-Dashboards-ci-group-{i + 1}") + self.assertEqual(test_report_runner_data["components"][3]["name"], "alertingDashboards") + self.assertEqual(test_report_runner_data["components"][5]["name"], "ganttChartDashboards") @patch("yaml.safe_load") @patch("urllib.request.urlopen") @@ -90,30 +93,28 @@ def test_runner_component_entry_url(self, report_args_mock: MagicMock, validator yaml_safe_load_mock.return_value = {"test_result": "PASS"} urlopen_mock.return_value = MagicMock() - test_report_component_dict = TestReportRunner(report_args_mock, - self.TEST_MANIFEST_OPENSEARCH_DASHBOARDS).component_entry( - "alertingDashboards") + test_report_component_dict = TestReportRunner(report_args_mock, self.TEST_MANIFEST_OPENSEARCH_DASHBOARDS).component_entry("alertingDashboards") urlopen_mock.assert_has_calls([call( 'https://ci.opensearch.org/ci/dbc/mock/test-results/123/integ-test/alertingDashboards/with-security/alertingDashboards.yml')]) self.assertEqual(test_report_component_dict.get("configs")[0]["status"], "PASS") self.assertEqual(test_report_component_dict.get("configs")[0]["name"], "with-security") self.assertEqual(test_report_component_dict.get("configs")[0]["yml"], "https://ci.opensearch.org/ci/dbc/mock/test-results/123/integ-test/alertingDashboards/with-security/alertingDashboards.yml") - self.assertEqual(test_report_component_dict.get("configs")[0]["cluster_stdout"][0], "https://ci.opensearch.org/ci" - "/dbc/mock/test-results/123/integ-test/alertingDashboards/with-security/local-cluster-logs/id-0/stdout.txt") - self.assertEqual(test_report_component_dict.get("configs")[0]["cluster_stdout"][1], "https://ci.opensearch.org/ci" - "/dbc/mock/test-results/123/integ-test/alertingDashboards/with-security/local-cluster-logs/id-1/stdout.txt") - self.assertEqual(test_report_component_dict.get("configs")[0]["cluster_stderr"][0], "https://ci.opensearch.org/ci" - "/dbc/mock/test-results/123/integ-test/alertingDashboards/with-security/local-cluster-logs/id-0/stderr.txt") - self.assertEqual(test_report_component_dict.get("configs")[0]["cluster_stderr"][1], "https://ci.opensearch.org/ci" - "/dbc/mock/test-results/123/integ-test/alertingDashboards/with-security/local-cluster-logs/id-1/stderr.txt") + self.assertEqual(test_report_component_dict.get("configs")[0]["cluster_stdout"][0], + "https://ci.opensearch.org/ci""/dbc/mock/test-results/123/integ-test/alertingDashboards/with-security/local-cluster-logs/id-0/stdout.txt") + self.assertEqual(test_report_component_dict.get("configs")[0]["cluster_stdout"][1], + "https://ci.opensearch.org/ci""/dbc/mock/test-results/123/integ-test/alertingDashboards/with-security/local-cluster-logs/id-1/stdout.txt") + self.assertEqual(test_report_component_dict.get("configs")[0]["cluster_stderr"][0], + "https://ci.opensearch.org/ci""/dbc/mock/test-results/123/integ-test/alertingDashboards/with-security/local-cluster-logs/id-0/stderr.txt") + self.assertEqual(test_report_component_dict.get("configs")[0]["cluster_stderr"][1], + "https://ci.opensearch.org/ci""/dbc/mock/test-results/123/integ-test/alertingDashboards/with-security/local-cluster-logs/id-1/stderr.txt") self.assertEqual(test_report_component_dict.get("configs")[1]["name"], "without-security") - self.assertEqual(test_report_component_dict.get("configs")[1]["cluster_stdout"][0], "https://ci.opensearch.org/ci" - "/dbc/mock/test-results/123/integ-test/alertingDashboards/without-security/local-cluster-logs/id-2/stdout.txt") - self.assertEqual(test_report_component_dict.get("configs")[1]["cluster_stdout"][1], "https://ci.opensearch.org/ci" - "/dbc/mock/test-results/123/integ-test/alertingDashboards/without-security/local-cluster-logs/id-3/stdout.txt") - self.assertEqual(test_report_component_dict.get("configs")[1]["cluster_stderr"][0], "https://ci.opensearch.org/ci" - "/dbc/mock/test-results/123/integ-test/alertingDashboards/without-security/local-cluster-logs/id-2/stderr.txt") - self.assertEqual(test_report_component_dict.get("configs")[1]["cluster_stderr"][1], "https://ci.opensearch.org/ci" - "/dbc/mock/test-results/123/integ-test/alertingDashboards/without-security/local-cluster-logs/id-3/stderr.txt") + self.assertEqual(test_report_component_dict.get("configs")[1]["cluster_stdout"][0], + "https://ci.opensearch.org/ci""/dbc/mock/test-results/123/integ-test/alertingDashboards/without-security/local-cluster-logs/id-2/stdout.txt") + self.assertEqual(test_report_component_dict.get("configs")[1]["cluster_stdout"][1], + "https://ci.opensearch.org/ci""/dbc/mock/test-results/123/integ-test/alertingDashboards/without-security/local-cluster-logs/id-3/stdout.txt") + self.assertEqual(test_report_component_dict.get("configs")[1]["cluster_stderr"][0], + "https://ci.opensearch.org/ci""/dbc/mock/test-results/123/integ-test/alertingDashboards/without-security/local-cluster-logs/id-2/stderr.txt") + self.assertEqual(test_report_component_dict.get("configs")[1]["cluster_stderr"][1], + "https://ci.opensearch.org/ci""/dbc/mock/test-results/123/integ-test/alertingDashboards/without-security/local-cluster-logs/id-3/stderr.txt")