Skip to content

Commit

Permalink
Fix daily manifests workflow. (#847)
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock authored Nov 1, 2021
1 parent 72978e8 commit 3a1b8dd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/manifests_workflow/input_manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def update(self, min_klass, component_klass, keep=False):

# check out and build #main, 1.x, etc.
branches = min_klass.branches()

logging.info(f"Checking {self.name} {branches} branches")
for branch in branches:
c = min_klass.checkout(
Expand All @@ -59,7 +60,8 @@ def update(self, min_klass, component_klass, keep=False):
if component_klass is not None:
# components can increment their own version first without incrementing min
manifest = self.latest
for component in manifest.components:
logging.info(f"Examining components in the latest manifest of {manifest.build.name} ({manifest.build.version})")
for component in manifest.components.values():
if component.name == self.name:
continue

Expand Down
22 changes: 19 additions & 3 deletions tests/tests_manifests_workflow/test_input_manifests_opensearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def test_update(self, mock_input_manifest, mock_component_opensearch, mock_compo
mock_component_opensearch_min.checkout.return_value = MagicMock(version="0.9.0")
mock_component_opensearch.return_value = MagicMock(name="common-utils")
mock_component_opensearch.checkout.return_value = MagicMock(version="0.10.0")
mock_input_manifest_from_path.return_value = MagicMock(
components=[InputManifest.Component({"name": "common-utils", "repository": "git", "ref": "ref"})]
)
mock_input_manifest_from_path.return_value.components = {
"common-utils": InputManifest.Component({"name": "common-utils", "repository": "git", "ref": "ref"})
}
manifests = InputManifestsOpenSearch()
manifests.update()
self.assertEqual(mock_input_manifest().to_file.call_count, 2)
Expand All @@ -63,3 +63,19 @@ def test_update(self, mock_input_manifest, mock_component_opensearch, mock_compo
),
]
mock_input_manifest().to_file.assert_has_calls(calls)

@patch("os.makedirs")
@patch("os.chdir")
@patch("manifests_workflow.input_manifests_opensearch.ComponentOpenSearchMin")
@patch("manifests_workflow.input_manifests_opensearch.ComponentOpenSearch")
@patch("manifests_workflow.input_manifests_opensearch.InputManifestsOpenSearch.write_manifest")
def test_update_with_latest_manifest(self, mock_write_manifest, mock_component_opensearch, mock_component_opensearch_min, *mocks):
mock_component_opensearch_min.return_value = MagicMock(name="OpenSearch")
mock_component_opensearch_min.branches.return_value = ["main"]
mock_component_opensearch_min.checkout.return_value = MagicMock(version="0.9.0")
mock_component_opensearch.return_value = MagicMock(name="common-utils")
mock_component_opensearch.checkout.return_value = MagicMock(version="0.10.0")
manifests = InputManifestsOpenSearch()
manifests.update()
mock_component_opensearch_min.branches.assert_called()
mock_write_manifest.assert_called_with("0.9.0", [mock_component_opensearch_min.checkout.return_value])

0 comments on commit 3a1b8dd

Please sign in to comment.