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

[6.16]Podman Push - Podman Push Create and CV tests #14940

Merged
merged 14 commits into from
Aug 5, 2024
Merged
62 changes: 62 additions & 0 deletions tests/foreman/cli/test_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1320,3 +1320,65 @@ def test_positive_remove_docker_repo_ccv(
)
activation_key = module_target_sat.cli.ActivationKey.info({'id': activation_key['id']})
assert activation_key['content-view'] != comp_content_view['name']


class TestPodman:
sambible marked this conversation as resolved.
Show resolved Hide resolved
"""Tests specific to using podman push/pull on Satellite

:CaseComponent: Podman

:team: Phoenix-content
"""

@pytest.fixture(scope='class')
def enable_podman(module_product, module_target_sat):
"""Enable base_os and appstream repos on the sat through cdn registration and install podman.
Also includes a change to the katello.yaml file, and a restart of foreman"""
module_target_sat.register_to_cdn()
if module_target_sat.os_version.major > 7:
module_target_sat.enable_repo(module_target_sat.REPOS['rhel_bos']['id'])
module_target_sat.enable_repo(module_target_sat.REPOS['rhel_aps']['id'])
else:
module_target_sat.enable_repo(module_target_sat.REPOS['rhscl']['id'])
module_target_sat.enable_repo(module_target_sat.REPOS['rhel']['id'])
result = module_target_sat.execute(
'dnf install -y --disableplugin=foreman-protector podman'
)
assert result.status == 0
result = module_target_sat.execute(
r"sed -i '/:katello:/a\ \ :container_image_registry:\n :allow_push: true\n' /etc/foreman/plugins/katello.yaml"
)
vsedmik marked this conversation as resolved.
Show resolved Hide resolved
assert result.status == 0
result = module_target_sat.execute('foreman-maintain service restart --only foreman')
assert result.status == 0

@pytest.mark.tier2
def test_podman_push(self, module_target_sat, module_product, enable_podman):
"""Push a small and large container image to Pulp

:id: 488adc49-899e-4739-8bca-0cd255da63ae

:steps:
1. Using the enable_podman fixture, enable both base_os and appstream repos and install
sambible marked this conversation as resolved.
Show resolved Hide resolved
podman on satellite.
2. Using podman, pull a small and large image from the fedoraproject registry
3. Push both images to pulp

:expectedresults: A docker repository is created for both images, with a valid version id.

:CaseImportance: High
"""
result = module_target_sat.execute('podman pull registry.fedoraproject.org/arianna')
assert result.status == 0
result = module_target_sat.execute('podman pull registry.fedoraproject.org/fedora')
assert result.status == 0
small_image_id = module_target_sat.execute('podman images arianna -q')
assert small_image_id
large_image_id = module_target_sat.execute('podman images fedora -q')
assert small_image_id
podman_cmd = f'podman push --creds admin:changeme {small_image_id.stdout.strip()} {module_target_sat.hostname}/arianna'
result = module_target_sat.execute(podman_cmd)
module_target_sat.execute(
f'podman push --creds admin:changeme {large_image_id.stdout.strip()} {module_target_sat.hostname}/arianna'
sambible marked this conversation as resolved.
Show resolved Hide resolved
)
module_target_sat.execute('pulp container repository -t push list')
Loading