|
| 1 | +"""Test module for satellite-maintain health functionality |
| 2 | +
|
| 3 | +:Requirement: foreman-maintain |
| 4 | +
|
| 5 | +:CaseAutomation: Automated |
| 6 | +
|
| 7 | +:CaseComponent: SatelliteMaintain |
| 8 | +
|
| 9 | +:Team: Rocket |
| 10 | +
|
| 11 | +:CaseImportance: Critical |
| 12 | +
|
| 13 | +""" |
| 14 | + |
| 15 | +import pytest |
| 16 | + |
| 17 | +from robottelo.config import settings |
| 18 | + |
| 19 | + |
| 20 | +@pytest.mark.satellite_iop_only |
| 21 | +def test_podman_login_check(request, sat_maintain): |
| 22 | + """Test Podman login check with local Red Hat Lightspeed(IoP) Satellite. |
| 23 | +
|
| 24 | + :id: 70fd6d86-a647-442c-a971-cbd1207b734b |
| 25 | +
|
| 26 | + :setup: Configure a Satellite with local Red Hat Lightspeed(IoP) enabled. |
| 27 | +
|
| 28 | + :steps: |
| 29 | + 1. Run satellite-maintain update check. |
| 30 | + 2. Verify that the Podman login check passes. |
| 31 | + 3. Log out of the remote container registry. |
| 32 | + 4. Run satellite-maintain update check. |
| 33 | + 5. Verify that the Podman login check fails. |
| 34 | +
|
| 35 | + :Verifies: SAT-35282 |
| 36 | + """ |
| 37 | + iop_settings = settings.rh_cloud.iop_advisor_engine |
| 38 | + |
| 39 | + request.addfinalizer(lambda: sat_maintain.podman_logout(iop_settings.registry)) |
| 40 | + |
| 41 | + check_description = 'Check whether podman needs to be logged in to the registry' |
| 42 | + fail_message = ( |
| 43 | + 'You are using containers from registry.redhat.io,\n' |
| 44 | + 'but your system is not logged in to the registry, or the login expired.\n' |
| 45 | + 'Please login to registry.redhat.io.' |
| 46 | + ) |
| 47 | + # Login to Prod registry to ensure the check runs correctly, it won't work for any other registry |
| 48 | + sat_maintain.podman_login(iop_settings.username, iop_settings.token, iop_settings.registry) |
| 49 | + result = sat_maintain.cli.Health.check(options={'label': 'container-podman-login'}) |
| 50 | + assert 'FAIL' not in result.stdout |
| 51 | + assert check_description in result.stdout, result.stdout |
| 52 | + sat_maintain.podman_logout(iop_settings.registry) |
| 53 | + result = sat_maintain.cli.Health.check(options={'label': 'container-podman-login'}) |
| 54 | + assert 'FAIL' in result.stdout |
| 55 | + assert fail_message in result.stdout, result.stdout |
0 commit comments