Skip to content

Commit 348bef0

Browse files
committed
test: move podman login check to destructive tests
1 parent ae274a6 commit 348bef0

2 files changed

Lines changed: 49 additions & 38 deletions

File tree

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

tests/foreman/maintain/test_health.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -28,44 +28,6 @@
2828
}
2929

3030

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

0 commit comments

Comments
 (0)