Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a wait for product to unlock to post-publish (AWS) #84

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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