Skip to content

Commit

Permalink
cockpit: test coverage for #1876220
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Dragun authored and mshriver committed May 1, 2022
1 parent 9b1e4e1 commit bece225
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions tests/foreman/ui/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -2357,27 +2357,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

0 comments on commit bece225

Please sign in to comment.