Skip to content

Commit

Permalink
Update distribution manifest location
Browse files Browse the repository at this point in the history
Signed-off-by: Zelin Hao <[email protected]>
  • Loading branch information
zelinh committed Jun 28, 2023
1 parent a293212 commit f2c1422
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/report_workflow/test_run_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def __init__(self, args: ReportArgs, test_manifest: TestManifest) -> None:
for k, v in self.args.artifact_paths.items():
self.artifact_paths = " ".join([self.artifact_paths, k + "=" + v]).strip(" ")

self.dist_manifest = "/".join([self.args.artifact_paths[self.name], "dist", self.name, "manifest.yml"])
self.dist_manifest = "/".join([self.args.artifact_paths[self.name], "dist", self.name, "manifest.yml"]) if self.args.artifact_paths[self.name].startswith("https://") \
else os.path.join(self.args.artifact_paths[self.name], "dist", self.name, "manifest.yml")
self.test_components = self.test_manifest.components

def update_data(self) -> dict:
Expand Down
19 changes: 17 additions & 2 deletions tests/tests_report_workflow/test_test_run_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_runner_init(self, report_args_mock: MagicMock, test_manifest_mock: Magi

@patch("report_workflow.report_args.ReportArgs")
@patch("manifests.test_manifest.TestManifest")
def test_runner_update_test_run_data(self, report_args_mock: MagicMock, test_manifest_mock: MagicMock) -> None:
def test_runner_update_test_run_data_local(self, report_args_mock: MagicMock, test_manifest_mock: MagicMock) -> None:
report_args_mock.test_manifest_path = self.TEST_MANIFEST_PATH
report_args_mock.artifact_paths = {"opensearch": "foo/bar"}
report_args_mock.test_run_id = 123
Expand All @@ -53,7 +53,22 @@ def test_runner_update_test_run_data(self, report_args_mock: MagicMock, test_man
self.assertEqual(test_run_dict.get("Command"), " ".join(["./test.sh", "integ-test", self.TEST_MANIFEST_PATH, "--paths", "opensearch=foo/bar"]))
self.assertEqual(test_run_dict.get("TestType"), "integ-test")
self.assertEqual(test_run_dict.get("TestManifest"), self.TEST_MANIFEST_PATH)
self.assertEqual(test_run_dict.get("DistributionManifest"), "/".join(["foo/bar", "dist", "opensearch", "manifest.yml"]))
self.assertEqual(test_run_dict.get("DistributionManifest"), os.path.join("foo/bar", "dist", "opensearch", "manifest.yml"))
self.assertEqual(test_run_dict.get("TestID"), "123")

@patch("report_workflow.report_args.ReportArgs")
@patch("manifests.test_manifest.TestManifest")
def test_runner_update_test_run_data_url(self, report_args_mock: MagicMock, test_manifest_mock: MagicMock) -> None:
report_args_mock.test_manifest_path = self.TEST_MANIFEST_PATH
report_args_mock.artifact_paths = {"opensearch": "https://foo/bar"}
report_args_mock.test_run_id = 123
report_args_mock.test_type = "integ-test"

test_run_dict = TestRunRunner(report_args_mock, self.TEST_MANIFEST).update_test_run_data()
self.assertEqual(test_run_dict.get("Command"), " ".join(["./test.sh", "integ-test", self.TEST_MANIFEST_PATH, "--paths", "opensearch=https://foo/bar"]))
self.assertEqual(test_run_dict.get("TestType"), "integ-test")
self.assertEqual(test_run_dict.get("TestManifest"), self.TEST_MANIFEST_PATH)
self.assertEqual(test_run_dict.get("DistributionManifest"), "/".join(["https://foo/bar", "dist", "opensearch", "manifest.yml"]))
self.assertEqual(test_run_dict.get("TestID"), "123")

@patch("yaml.safe_load")
Expand Down

0 comments on commit f2c1422

Please sign in to comment.