Skip to content

Commit

Permalink
Adds a wait for product to unlock to post-publish (AWS)
Browse files Browse the repository at this point in the history
  • Loading branch information
jajreidy committed Nov 27, 2024
1 parent e28a3d3 commit 8505c7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/pubtools/_marketplacesvm/cloud_providers/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,9 @@ def _post_publish(
restrict_minor = kwargs.get("restrict_minor")

if restrict_version:
# Check if this product is locked currently and wait for it to become unlocked
LOG.info("Checking for active changesets in: %s", push_item.dest[0])
self.publish_svc.wait_active_changesets(push_item.dest[0])
LOG.info(
"Starting to restrict versions: restrict_major = %s, restrict_minor = %s",
restrict_major,
Expand Down
7 changes: 3 additions & 4 deletions tests/cloud_providers/test_provider_aws.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from datetime import datetime
from typing import Any, Dict, Union
from unittest.mock import MagicMock, patch
from unittest.mock import MagicMock, call, patch

import pytest
from attrs import evolve
Expand Down Expand Up @@ -704,9 +704,7 @@ def test_publish(
mock_metadata.assert_called_once_with(**metadata)
fake_aws_provider.publish_svc.publish.assert_called_once_with(meta_obj)
fake_aws_provider.upload_svc_partial.upload.assert_not_called() # type: ignore [attr-defined] # noqa: E501
fake_aws_provider.publish_svc.wait_active_changesets.assert_called_once_with(
aws_push_item.dest[0]
)
fake_aws_provider.publish_svc.wait_active_changesets.assert_has_calls([call('product-uuid')])


@pytest.mark.parametrize("new_base_product", ["test-base", None])
Expand Down Expand Up @@ -795,6 +793,7 @@ def test_publish_version_exists(
assert res == {}

mock_metadata.assert_not_called()
fake_aws_provider.publish_svc.wait_active_changesets.assert_has_calls([call('product-uuid')])
fake_aws_provider.publish_svc.publish.assert_not_called()
fake_aws_provider.upload_svc_partial.upload.assert_not_called() # type: ignore [attr-defined] # noqa: E501

Expand Down

0 comments on commit 8505c7d

Please sign in to comment.