Skip to content

Commit

Permalink
Fix container tags related failures
Browse files Browse the repository at this point in the history
  • Loading branch information
vsedmik committed Jul 9, 2024
1 parent 882884d commit 873816a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
4 changes: 2 additions & 2 deletions tests/foreman/cli/test_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ def test_positive_sync(self, repo, module_target_sat):
:CaseImportance: Critical
"""
assert int(repo['content-counts']['container-image-manifests']) == 0
assert int(repo['content-counts']['container-manifests']) == 0
module_target_sat.cli.Repository.synchronize({'id': repo['id']})
repo = module_target_sat.cli.Repository.info({'id': repo['id']})
assert int(repo['content-counts']['container-image-manifests']) > 0
assert int(repo['content-counts']['container-manifests']) > 0

@pytest.mark.tier1
@pytest.mark.parametrize('new_name', **parametrized(valid_docker_repository_names()))
Expand Down
38 changes: 21 additions & 17 deletions tests/foreman/cli/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ def _validated_image_tags_count(repo, sat):
immediately after synchronization), which was CLOSED WONTFIX
"""
wait_for(
lambda: int(
_get_image_tags_count(repo=repo, sat=sat)['content-counts']['container-image-tags']
)
lambda: int(_get_image_tags_count(repo=repo, sat=sat)['content-counts']['container-tags'])
> 0,
timeout=30,
delay=2,
Expand Down Expand Up @@ -910,13 +908,16 @@ def test_positive_synchronize_docker_repo_set_tags_later_additive(self, repo, ta
tags = 'latest'
target_sat.cli.Repository.synchronize({'id': repo['id']})
repo = _validated_image_tags_count(repo=repo, sat=target_sat)
assert not repo['container-image-tags-filter']
assert int(repo['content-counts']['container-image-tags']) >= 2
# assert not repo['container-image-tags-filter']
tags_count = int(repo['content-counts']['container-tags'])
assert tags_count >= 2, 'insufficient tags count in the repo'
target_sat.cli.Repository.update({'id': repo['id'], 'include-tags': tags})
target_sat.cli.Repository.synchronize({'id': repo['id']})
repo = _validated_image_tags_count(repo=repo, sat=target_sat)
assert tags in repo['container-image-tags-filter']
assert int(repo['content-counts']['container-image-tags']) >= 2
# assert tags in repo['container-image-tags-filter']
assert (
int(repo['content-counts']['container-tags']) == tags_count
), 'unexpected change of tags count'

@pytest.mark.tier2
@pytest.mark.parametrize(
Expand Down Expand Up @@ -948,13 +949,16 @@ def test_positive_synchronize_docker_repo_set_tags_later_content_only(self, repo
tags = 'latest'
target_sat.cli.Repository.synchronize({'id': repo['id']})
repo = _validated_image_tags_count(repo=repo, sat=target_sat)
assert not repo['container-image-tags-filter']
assert int(repo['content-counts']['container-image-tags']) >= 2
# assert not repo['container-image-tags-filter']
tags_count = int(repo['content-counts']['container-tags'])
assert tags_count >= 2, 'insufficient tags count in the repo'
target_sat.cli.Repository.update({'id': repo['id'], 'include-tags': tags})
target_sat.cli.Repository.synchronize({'id': repo['id']})
repo = _validated_image_tags_count(repo=repo, sat=target_sat)
assert tags in repo['container-image-tags-filter']
assert int(repo['content-counts']['container-image-tags']) <= 2
# assert tags in repo['container-image-tags-filter']
assert (
int(repo['content-counts']['container-tags']) == len(tags.split(',')) < tags_count
), 'unexpected change of tags count'

@pytest.mark.tier2
@pytest.mark.parametrize(
Expand Down Expand Up @@ -985,9 +989,9 @@ def test_negative_synchronize_docker_repo_with_mix_valid_invalid_tags(
"""
target_sat.cli.Repository.synchronize({'id': repo['id']})
repo = _validated_image_tags_count(repo=repo, sat=target_sat)
for tag in repo_options['include-tags'].split(','):
assert tag in repo['container-image-tags-filter']
assert int(repo['content-counts']['container-image-tags']) == 1
# for tag in repo_options['include-tags'].split(','):
# assert tag in repo['container-image-tags-filter']
assert int(repo['content-counts']['container-tags']) == 1

@pytest.mark.tier2
@pytest.mark.parametrize(
Expand Down Expand Up @@ -1018,9 +1022,9 @@ def test_negative_synchronize_docker_repo_with_invalid_tags(
"""
target_sat.cli.Repository.synchronize({'id': repo['id']})
repo = target_sat.cli.Repository.info({'id': repo['id']})
for tag in repo_options['include-tags'].split(','):
assert tag in repo['container-image-tags-filter']
assert int(repo['content-counts']['container-image-tags']) == 0
# for tag in repo_options['include-tags'].split(','):
# assert tag in repo['container-image-tags-filter']
assert int(repo['content-counts']['container-tags']) == 0

@pytest.mark.tier2
@pytest.mark.parametrize(
Expand Down

0 comments on commit 873816a

Please sign in to comment.