Skip to content

Commit

Permalink
content with longer name (SatelliteQE#12442)
Browse files Browse the repository at this point in the history
* Partial work - content with longer name

* worked on review comments, make sure podman pull command working

* changed podman pull command
  • Loading branch information
vijaysawant authored Sep 5, 2023
1 parent 209f651 commit 3d1863d
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions tests/foreman/cli/test_container_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,79 @@ def test_positive_container_admin_end_to_end_pull(
# 9. Pull in docker image
result = container_contenthost.execute(docker_pull_command)
assert result.status == 0

def test_negative_pull_content_with_longer_name(
self, target_sat, container_contenthost, module_org
):
"""Verify that long name CV publishes when CV & docker repo both have a larger name.
:id: e0ac0be4-f5ff-4a88-bb29-33aa2d874f46
:steps:
1. Create Product, docker repo, CV and LCE with a long name
2. Sync the repos
3. Add repository to CV, Publish, and then Promote CV to LCE
4. Pull in docker image
:expectedresults:
1. Long Product, repository, CV and LCE should create successfully
2. Sync repository successfully
3. Publish & Promote should success
4. Can pull in docker images
:BZ: 2127470
:customerscenario: true
"""
pattern_postfix = gen_string('alpha', 10).lower()

product_name = f'containers-{pattern_postfix}'
repo_name = f'repo-{pattern_postfix}'
lce_name = f'lce-{pattern_postfix}'
cv_name = f'cv-{pattern_postfix}'

# 1. Create Product, docker repo, CV and LCE with a long name
product = target_sat.cli_factory.make_product_wait(
{'name': product_name, 'organization-id': module_org.id}
)

repo = _repo(product['id'], name=repo_name, upstream_name=CONTAINER_UPSTREAM_NAME)

# 2. Sync the repos
target_sat.cli.Repository.synchronize({'id': repo['id']})

lce = target_sat.cli_factory.make_lifecycle_environment(
{'name': lce_name, 'organization-id': module_org.id}
)
cv = target_sat.cli_factory.make_content_view(
{'name': cv_name, 'composite': False, 'organization-id': module_org.id}
)

# 3. Add repository to CV, Publish, and then Promote CV to LCE
target_sat.cli.ContentView.add_repository({'id': cv['id'], 'repository-id': repo['id']})

target_sat.cli.ContentView.publish({'id': cv['id']})
cv = target_sat.cli.ContentView.info({'id': cv['id']})
target_sat.cli.ContentView.version_promote(
{'id': cv['versions'][0]['id'], 'to-lifecycle-environment-id': lce['id']}
)

podman_pull_command = (
f"podman pull --tls-verify=false {target_sat.hostname}/{module_org.label.lower()}"
f"-{lce['label'].lower()}-{cv['label'].lower()}-{product['label'].lower()}-{repo_name}"
)

# 4. Pull in docker image
assert (
container_contenthost.execute(
f'podman login -u {settings.server.admin_username}'
f' -p {settings.server.admin_password} {target_sat.hostname}'
).status
== 0
)

assert container_contenthost.execute(podman_pull_command).status == 0

assert container_contenthost.execute(f'podman logout {target_sat.hostname}').status == 0

0 comments on commit 3d1863d

Please sign in to comment.