Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
Signed-off-by: Zelin Hao <[email protected]>
  • Loading branch information
zelinh committed Dec 14, 2023
1 parent 87fddd6 commit 00b37f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/run_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def main() -> int:
list_of_updated_plugins = buildIncremental.commits_diff(manifest)
components = buildIncremental.rebuild_plugins(list_of_updated_plugins, manifest)
logging.info(f"Plugins for incremental build: {components}")
# buildIncremental.build_incremental(args, manifest, ["common-utils"])
buildIncremental.build_incremental(args, manifest, components)
return 0

Expand Down
9 changes: 9 additions & 0 deletions tests/test_run_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,12 @@ def test_failed_plugins_default(self, mock_logging_error: Mock, mock_temp: Mock,
with pytest.raises(Exception, match="Error during build"):
main()
mock_logging_error.assert_called_with(f"Error building common-utils, retry with: run_build.py {self.NON_OPENSEARCH_MANIFEST} --component common-utils")

@patch("argparse._sys.argv", ["run_build.py", OPENSEARCH_MANIFEST, "--incremental"])
@patch("run_build.BuildIncremental")
def test_main_incremental(self, mock_build_incremental: Mock, *mocks: Any) -> None:
main()
self.assertEqual(mock_build_incremental.call_count, 1)
mock_build_incremental.return_value.commits_diff.assert_called()
mock_build_incremental.return_value.rebuild_plugins.assert_called()
mock_build_incremental.return_value.build_incremental.assert_called()

0 comments on commit 00b37f7

Please sign in to comment.