|
27 | 27 | } |
28 | 28 |
|
29 | 29 |
|
| 30 | +@pytest.mark.satellite_iop_only |
| 31 | +def test_podman_login_check(request, sat_maintain): |
| 32 | + """Test Podman login check with local Red Hat Lightspeed(IoP) Satellite. |
| 33 | +
|
| 34 | + :id: 70fd6d86-a647-442c-a971-cbd1207b734b |
| 35 | +
|
| 36 | + :setup: Configure a Satellite with local Red Hat Lightspeed(IoP) enabled. |
| 37 | +
|
| 38 | + :steps: |
| 39 | + 1. Run satellite-maintain update check. |
| 40 | + 2. Verify that the Podman login check passes. |
| 41 | + 3. Log out of the remote container registry. |
| 42 | + 4. Run satellite-maintain update check. |
| 43 | + 5. Verify that the Podman login check fails. |
| 44 | +
|
| 45 | + :Verifies: SAT-35282 |
| 46 | + """ |
| 47 | + iop_settings = settings.rh_cloud.iop_advisor_engine |
| 48 | + |
| 49 | + request.addfinalizer(lambda: sat_maintain.podman_logout(iop_settings.registry)) |
| 50 | + |
| 51 | + check_description = 'Check whether podman needs to be logged in to the registry' |
| 52 | + fail_message = ( |
| 53 | + 'You are using containers from registry.redhat.io,\n' |
| 54 | + 'but your system is not logged in to the registry, or the login expired.\n' |
| 55 | + 'Please login to registry.redhat.io.' |
| 56 | + ) |
| 57 | + # Login to Prod registry to ensure the check runs correctly, it won't work for any other registry |
| 58 | + sat_maintain.podman_login(iop_settings.username, iop_settings.token, iop_settings.registry) |
| 59 | + result = sat_maintain.cli.Health.check(options={'label': 'container-podman-login'}) |
| 60 | + assert 'FAIL' not in result.stdout |
| 61 | + assert check_description in result.stdout, result.stdout |
| 62 | + sat_maintain.podman_logout(iop_settings.registry) |
| 63 | + result = sat_maintain.cli.Health.check(options={'label': 'container-podman-login'}) |
| 64 | + assert 'FAIL' in result.stdout |
| 65 | + assert fail_message in result.stdout, result.stdout |
| 66 | + |
| 67 | + |
30 | 68 | @pytest.mark.include_capsule |
31 | 69 | def test_positive_health_list(sat_maintain): |
32 | 70 | """List health check in satellite-maintain |
|
0 commit comments