Skip to content

Commit ca0e854

Browse files
nacooolweb-flow
authored andcommitted
Move test_podman_login_check to destructive tests (#20849)
(cherry picked from commit 5deb533)
1 parent 8b61806 commit ca0e854

2 files changed

Lines changed: 55 additions & 38 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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
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

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
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)