Skip to content

Commit

Permalink
Update python tests
Browse files Browse the repository at this point in the history
Signed-off-by: Zelin Hao <[email protected]>
  • Loading branch information
zelinh committed Aug 21, 2024
1 parent d8e7eb5 commit 34c16e9
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions tests/tests_report_workflow/test_test_report_runner_dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")

0 comments on commit 34c16e9

Please sign in to comment.