Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cockpit: test coverage for #1876220 #9527

Merged
merged 1 commit into from
May 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 35 additions & 6 deletions tests/foreman/ui/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -2304,27 +2304,56 @@ def test_positive_gce_cloudinit_provision_end_to_end(
@pytest.mark.rhel_ver_match('[^6].*')
@pytest.mark.usefixtures('install_cockpit_plugin')
@pytest.mark.tier2
def test_positive_cockpit(session, cockpit_host, module_org):
"""Install cockpit plugin and test whether webconsole button and cockpit integration works
def test_positive_cockpit(session, cockpit_host, default_sat, module_org):
"""Install cockpit plugin and test whether webconsole button and cockpit integration works.
also verify if cockpit service is restarted after the service restart.

:id: 5a9be063-cdc4-43ce-91b9-7608fbebf8bb

:expectedresults: Cockpit page is loaded and displays sat host info

:BZ: 1876220

:CaseLevel: System

:steps:
1. kill the cockpit service.
2. go to web console and verify if getting 503 error.
3. check if service "cockpit.service" exists using service list.
4. restart the satellite services.
5. check cockpit page is loaded and displays sat host info.

expectedresults:
1. cockpit service is restarted after the services restart.
2. cockpit page is loaded and displays sat host info

:parametrized: yes
"""
with session:
session.organization.select(org_name=module_org.name)
session.location.select(loc_name='Any Location')
kill_process = default_sat.execute('pkill -f cockpit-ws')
assert kill_process.status == 0
# Verify if getting 503 error
with pytest.raises(NoSuchElementException):
session.host.get_webconsole_content(entity_name=cockpit_host.hostname)
title = session.browser.title
assert "503 Service Unavailable" in title

service_list = default_sat.cli.Service.list()
assert service_list.status == 0
assert "foreman-cockpit.service" in service_list.stdout

service_restart = default_sat.cli.Service.restart()
assert service_restart.status == 0
session.browser.switch_to_window(session.browser.window_handles[0])
session.browser.close_window(session.browser.window_handles[-1])
hostname_inside_cockpit = session.host.get_webconsole_content(
entity_name=cockpit_host.hostname, rhel_version=cockpit_host.os_version.major
)
assert (
hostname_inside_cockpit == cockpit_host.hostname
), 'cockpit page shows hostname {} instead of {}'.format(
hostname_inside_cockpit, cockpit_host.hostname
assert hostname_inside_cockpit == cockpit_host.hostname, (
f'cockpit page shows hostname {hostname_inside_cockpit} '
f'instead of {cockpit_host.hostname}'
)


Expand Down