Skip to content

Commit 629fbd8

Browse files
committed
Fix test_podman_login_check finalizer to restore podman login after test
1 parent b63db29 commit 629fbd8

2 files changed

Lines changed: 3 additions & 59 deletions

File tree

pytest_fixtures/component/maintain.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def sat_maintain(request):
5757
infra_host.register_to_cdn()
5858
else:
5959
infra_host = _get_satellite_host(request)
60-
60+
if getattr(infra_host, 'iop_enabled', False):
61+
satellite = request.getfixturevalue('module_target_sat')
62+
satellite.uninstall_iop()
6163
yield infra_host
6264

6365
if host_type == 'satellite_iop':

tests/foreman/maintain/test_health.py

Lines changed: 0 additions & 58 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
@@ -166,26 +128,6 @@ def test_positive_health_check_by_tags(sat_maintain):
166128
)
167129

168130

169-
@pytest.mark.include_capsule
170-
def test_positive_health_check_pre_upgrade(sat_maintain):
171-
"""Verify pre-upgrade health checks
172-
173-
:id: f52bd43e-79cd-488b-adbb-3c9e5bac32cc
174-
175-
:parametrized: yes
176-
177-
:steps:
178-
1. Run satellite-maintain health check --tags pre-upgrade
179-
180-
:expectedresults: Pre-upgrade health checks should pass.
181-
"""
182-
result = sat_maintain.cli.Health.check(
183-
options={'tags': 'pre-upgrade', 'whitelist': 'non-rh-packages'}
184-
)
185-
assert result.status == 0
186-
assert 'FAIL' not in result.stdout
187-
188-
189131
@pytest.mark.include_capsule
190132
def test_positive_health_check_server_ping(sat_maintain):
191133
"""Verify server ping check

0 commit comments

Comments
 (0)