From 31d938135890a01a6d8a33b3485b696d80f18d26 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Tue, 5 Sep 2023 14:35:56 -0400 Subject: [PATCH] [6.13.z] content with longer name (#12501) --- .../foreman/cli/test_container_management.py | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/tests/foreman/cli/test_container_management.py b/tests/foreman/cli/test_container_management.py index 3574b764165..e3c2f419f3c 100644 --- a/tests/foreman/cli/test_container_management.py +++ b/tests/foreman/cli/test_container_management.py @@ -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