Skip to content

Commit 6456cd4

Browse files
[6.18.z] Move test_positive_cockpit to Remote Execution (#22213)
618z_move_test_positive_cockpit_to_rex_component
1 parent 48ea4cc commit 6456cd4

2 files changed

Lines changed: 77 additions & 95 deletions

File tree

tests/foreman/destructive/test_host.py

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

tests/foreman/destructive/test_remoteexecution.py

Lines changed: 77 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
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,78 @@ 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+
@pytest.mark.upgrade
147+
@pytest.mark.rhel_ver_match('[^6].*')
148+
@pytest.mark.no_containers
149+
def test_positive_cockpit(self, cockpit_host, class_cockpit_sat, class_org):
150+
"""Install cockpit plugin and test whether webconsole button and cockpit integration works.
151+
also verify if cockpit service is restarted after the service restart.
152+
153+
:id: 5a9be063-cdc4-43ce-91b9-7608fbebf8bb
154+
155+
:expectedresults: Cockpit page is loaded and displays sat host info
156+
157+
:BZ: 1876220
158+
159+
:steps:
160+
1. kill the cockpit service.
161+
2. go to web console and verify if getting 503 error.
162+
3. check if service "cockpit.service" exists using service list.
163+
4. restart the satellite services.
164+
5. check cockpit page is loaded and displays sat host info.
165+
166+
:expectedresults:
167+
1. cockpit service is restarted after the services restart.
168+
2. cockpit page is loaded and displays sat host info
169+
170+
:Verifies: SAT-27411, SAT-36783
171+
172+
:customerscenario: true
173+
174+
:parametrized: yes
175+
"""
176+
with class_cockpit_sat.ui_session() as session:
177+
session.organization.select(org_name=class_org.name)
178+
session.location.select(loc_name=ANY_CONTEXT['location'])
179+
kill_process = class_cockpit_sat.execute('pkill -f cockpit-ws')
180+
assert kill_process.status == 0
181+
# Verify if getting 503 error
182+
with pytest.raises(NoSuchElementException):
183+
session.host.get_webconsole_content(entity_name=cockpit_host.hostname)
184+
title = session.browser.title
185+
assert "503 Service Unavailable" in title
186+
187+
service_list = class_cockpit_sat.cli.Service.list()
188+
assert service_list.status == 0
189+
assert "foreman-cockpit.service" in service_list.stdout
190+
191+
service_restart = class_cockpit_sat.cli.Service.restart()
192+
assert service_restart.status == 0
193+
# SAT-36783 can be triggered by just having wide characters anywhere
194+
# in the payload that gets sent between Satellite, Capsule and
195+
# cockpit. The password doesn't have to be accepted, it doesn't even
196+
# have to be used. Its mere presence in the communication should be
197+
# enough to trigger the bug.
198+
class_cockpit_sat.cli.Host.set_parameter(
199+
{
200+
'host': cockpit_host.hostname,
201+
'name': 'remote_execution_ssh_password',
202+
'value': '「£」はポンド記号です',
203+
}
204+
)
205+
206+
session.browser.switch_to_window(session.browser.window_handles[0])
207+
session.browser.close_window(session.browser.window_handles[-1])
208+
hostname_inside_cockpit = session.host.get_webconsole_content(
209+
entity_name=cockpit_host.hostname,
210+
rhel_version=cockpit_host.os_version.major,
211+
)
212+
assert cockpit_host.hostname in hostname_inside_cockpit, (
213+
f'cockpit page shows hostname {hostname_inside_cockpit} '
214+
f'instead of {cockpit_host.hostname}'
215+
)

0 commit comments

Comments
 (0)