Skip to content
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
55 changes: 55 additions & 0 deletions tests/foreman/destructive/test_fm_health.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""Test module for satellite-maintain health functionality

:Requirement: foreman-maintain

:CaseAutomation: Automated

:CaseComponent: SatelliteMaintain

:Team: Rocket

:CaseImportance: Critical

"""

import pytest

from robottelo.config import settings


@pytest.mark.satellite_iop_only
def test_podman_login_check(request, sat_maintain):
"""Test Podman login check with local Red Hat Lightspeed(IoP) Satellite.

:id: 70fd6d86-a647-442c-a971-cbd1207b734b

:setup: Configure a Satellite with local Red Hat Lightspeed(IoP) enabled.

:steps:
1. Run satellite-maintain update check.
2. Verify that the Podman login check passes.
3. Log out of the remote container registry.
4. Run satellite-maintain update check.
5. Verify that the Podman login check fails.

:Verifies: SAT-35282
"""
iop_settings = settings.rh_cloud.iop

request.addfinalizer(lambda: sat_maintain.podman_logout(iop_settings.registry))

check_description = 'Check whether podman needs to be logged in to the registry'
fail_message = (
'You are using containers from registry.redhat.io,\n'
'but your system is not logged in to the registry, or the login expired.\n'
'Please login to registry.redhat.io.'
)
# Login to Prod registry to ensure the check runs correctly, it won't work for any other registry
sat_maintain.podman_login(iop_settings.username, iop_settings.token, iop_settings.registry)
result = sat_maintain.cli.Health.check(options={'label': 'container-podman-login'})
assert 'FAIL' not in result.stdout
assert check_description in result.stdout, result.stdout
sat_maintain.podman_logout(iop_settings.registry)
result = sat_maintain.cli.Health.check(options={'label': 'container-podman-login'})
assert 'FAIL' in result.stdout
assert fail_message in result.stdout, result.stdout
38 changes: 0 additions & 38 deletions tests/foreman/maintain/test_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,44 +28,6 @@
}


@pytest.mark.satellite_iop_only
def test_podman_login_check(request, sat_maintain):
"""Test Podman login check with local Red Hat Lightspeed(IoP) Satellite.

:id: 70fd6d86-a647-442c-a971-cbd1207b734b

:setup: Configure a Satellite with local Red Hat Lightspeed(IoP) enabled.

:steps:
1. Run satellite-maintain update check.
2. Verify that the Podman login check passes.
3. Log out of the remote container registry.
4. Run satellite-maintain update check.
5. Verify that the Podman login check fails.

:Verifies: SAT-35282
"""
iop_settings = settings.rh_cloud.iop

request.addfinalizer(lambda: sat_maintain.podman_logout(iop_settings.registry))

check_description = 'Check whether podman needs to be logged in to the registry'
fail_message = (
'You are using containers from registry.redhat.io,\n'
'but your system is not logged in to the registry, or the login expired.\n'
'Please login to registry.redhat.io.'
)
# Login to Prod registry to ensure the check runs correctly, it won't work for any other registry
sat_maintain.podman_login(iop_settings.username, iop_settings.token, iop_settings.registry)
result = sat_maintain.cli.Health.check(options={'label': 'container-podman-login'})
assert 'FAIL' not in result.stdout
assert check_description in result.stdout, result.stdout
sat_maintain.podman_logout(iop_settings.registry)
result = sat_maintain.cli.Health.check(options={'label': 'container-podman-login'})
assert 'FAIL' in result.stdout
assert fail_message in result.stdout, result.stdout


@pytest.mark.include_capsule
def test_positive_health_list(sat_maintain):
"""List health check in satellite-maintain
Expand Down
Loading