Skip to content

Commit 7baf5f1

Browse files
[6.16.z] Move test_positive_cockpit to Remote Execution (#22215)
616z_move_test_positive_cockpit_to_rex_component
1 parent 44ca124 commit 7baf5f1

2 files changed

Lines changed: 66 additions & 82 deletions

File tree

tests/foreman/destructive/test_host.py

Lines changed: 0 additions & 82 deletions
This file was deleted.

tests/foreman/destructive/test_remoteexecution.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
1313
"""
1414

15+
from airgun.exceptions import NoSuchElementException
1516
from fauxfactory import gen_string
1617
from nailgun import client
1718
from nailgun.entity_mixins import TaskFailedError
1819
import pytest
1920

2021
from robottelo.config import get_credentials, settings
22+
from robottelo.constants import ANY_CONTEXT
2123
from robottelo.hosts import get_sat_version
2224

2325
CAPSULE_TARGET_VERSION = f'6.{get_sat_version().minor}.z'
@@ -136,3 +138,67 @@ def test_positive_use_alternate_directory(
136138
task = target_sat.cli.Task.list_tasks({'search': command})[0]
137139
search = target_sat.cli.Task.list_tasks({'search': f'id={task["id"]}'})
138140
assert search[0]['action'] == task['action']
141+
142+
143+
class TestCockpit:
144+
"""Tests for cockpit plugin"""
145+
146+
pytestmark = pytest.mark.destructive
147+
148+
@pytest.mark.upgrade
149+
@pytest.mark.rhel_ver_match(r'^\d+$')
150+
@pytest.mark.no_containers
151+
def test_positive_cockpit(self, cockpit_host, class_cockpit_sat, class_org):
152+
"""Install cockpit plugin and test whether webconsole button and cockpit integration works.
153+
also verify if cockpit service is restarted after the service restart.
154+
155+
:id: 5a9be063-cdc4-43ce-91b9-7608fbebf8bb
156+
157+
:expectedresults: Cockpit page is loaded and displays sat host info
158+
159+
:BZ: 1876220
160+
161+
:steps:
162+
1. kill the cockpit service.
163+
2. go to web console and verify if getting 503 error.
164+
3. check if service "cockpit.service" exists using service list.
165+
4. restart the satellite services.
166+
5. check cockpit page is loaded and displays sat host info.
167+
168+
:expectedresults:
169+
1. cockpit service is restarted after the services restart.
170+
2. cockpit page is loaded and displays sat host info
171+
172+
:Verifies: SAT-27411
173+
174+
:customerscenario: true
175+
176+
:parametrized: yes
177+
"""
178+
with class_cockpit_sat.ui_session() as session:
179+
session.organization.select(org_name=class_org.name)
180+
session.location.select(loc_name=ANY_CONTEXT['location'])
181+
kill_process = class_cockpit_sat.execute('pkill -f cockpit-ws')
182+
assert kill_process.status == 0
183+
# Verify if getting 503 error
184+
with pytest.raises(NoSuchElementException):
185+
session.host.get_webconsole_content(entity_name=cockpit_host.hostname)
186+
title = session.browser.title
187+
assert "503 Service Unavailable" in title
188+
189+
service_list = class_cockpit_sat.cli.Service.list()
190+
assert service_list.status == 0
191+
assert "foreman-cockpit.service" in service_list.stdout
192+
193+
service_restart = class_cockpit_sat.cli.Service.restart()
194+
assert service_restart.status == 0
195+
session.browser.switch_to_window(session.browser.window_handles[0])
196+
session.browser.close_window(session.browser.window_handles[-1])
197+
hostname_inside_cockpit = session.host.get_webconsole_content(
198+
entity_name=cockpit_host.hostname,
199+
rhel_version=cockpit_host.os_version.major,
200+
)
201+
assert cockpit_host.hostname in hostname_inside_cockpit, (
202+
f'cockpit page shows hostname {hostname_inside_cockpit} '
203+
f'instead of {cockpit_host.hostname}'
204+
)

0 commit comments

Comments
 (0)