add cockpit_default and cockpit_basic tests

Summary:
This adds tests for the Server_cockpit_default and cockpit_basic
test cases. Some notes: I was initially thinking of combining
these into a single test with multiple test modules and coming
up with a system for doing wiki reporting based on individual
test module status, but because we'll also want to do a cockpit
FreeIPA enrol test, I decided against it. We don't really want
to combine all three because then we would skip the cockpit
tests whenever FreeIPA server deployment failed, which isn't
ideal. So since we'll need a separate FreeIPA enrolment test
anyway it doesn't really make sense to go to the trouble of
designing a system for loading multiple postinstall tests (though
I have an idea for that!) and a per-module wiki reporting system.

This was the most minimal and hopefully reliable method for
running Cockpit from a stock Server install that I could think
of. An alternative approach would be to have, say, the most
recent stable Workstation live as a 'stock' asset and have two
tests, one which runs a stock Server install and just waits and
another which boots the live image and accesses the cockpit
running on the other box, but that seems a bit over-complex. It
is not possible to have dependencies between tests for different
ISOs, in case you were wondering about having a Workstation live
test which runs parallel with a Server DVD test, we can't do
that. One funny thing is the font that winds up getting used for
the desktop, but I don't *think* that should be a problem.

Picking needles was a bit tricky; any improvement suggestions
are welcome. I'm hoping it turns out to be safe to rely on some
dbus log messages being present; I think logging into Cockpit
triggers activation of the realmd dbus interface, so there
*should* always be some messages related to that. An alternative
would just be to match on a sliver of the dark grey table header
and the light grey row beneath it and assume that'll always be
the first message (whatever the message is), but then we have to
find some area of the message details screen which is always
present for any message, and it just seems a tad more likely to
result in false passes. Similary I'm making an assumption that
auditd is always going to show up on the first page of the
Services screen and the details screen will always show that
'loaded...enabled' text.

Test Plan:
Run the tests and see if they work! See
https://openqa.stg.fedoraproject.org/tests/21373 and
https://openqa.stg.fedoraproject.org/tests/21371 for my tests.

Reviewers: garretraziel

Reviewed By: garretraziel

Subscribers: tflink

Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D874
This commit is contained in:
Adam Williamson 2016-06-01 09:05:33 -07:00
parent 05f33bbd39
commit aba2814611
24 changed files with 294 additions and 0 deletions

View File

@ -56,6 +56,29 @@ sub menu_launch_type {
send_key 'ret';
}
sub start_cockpit {
my $self = shift;
my $login = shift || 0;
# run firefox directly in X as root. never do this, kids!
type_string "startx /usr/bin/firefox\n";
assert_screen "firefox";
# open a new tab so we don't race with the default page load
# (also focuses the location bar for us)
send_key "ctrl-t";
type_string "http://localhost:9090";
# firefox's stupid 'smart' url bar is a pain. wait for things to settle.
wait_still_screen 3;
send_key "ret";
assert_screen "cockpit_login";
if ($login) {
type_string "root";
send_key "tab";
type_string get_var("ROOT_PASSWORD", "weakpassword");
send_key "ret";
assert_screen "cockpit_main";
}
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 631,
"ypos": 126,
"width": 227,
"height": 77,
"type": "match"
}
],
"tags": [
"cockpit_login"
],
"properties": []
}

BIN
needles/cockpit/login.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

15
needles/cockpit/logs.json Normal file
View File

@ -0,0 +1,15 @@
{
"tags": [
"cockpit_logs"
],
"area": [
{
"xpos": 19,
"ypos": 206,
"width": 30,
"height": 15,
"type": "match"
}
],
"properties": []
}

BIN
needles/cockpit/logs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -0,0 +1,15 @@
{
"properties": [],
"area": [
{
"xpos": 448,
"ypos": 159,
"width": 47,
"height": 16,
"type": "match"
}
],
"tags": [
"cockpit_logs_notices"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -0,0 +1,15 @@
{
"properties": [],
"tags": [
"cockpit_logs_notices_detail"
],
"area": [
{
"xpos": 226,
"ypos": 353,
"width": 114,
"height": 14,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,15 @@
{
"tags": [
"cockpit_logs_notices_entry"
],
"area": [
{
"xpos": 665,
"ypos": 254,
"width": 125,
"height": 12,
"type": "match"
}
],
"properties": []
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

15
needles/cockpit/main.json Normal file
View File

@ -0,0 +1,15 @@
{
"tags": [
"cockpit_main"
],
"area": [
{
"xpos": 198,
"ypos": 111,
"width": 78,
"height": 22,
"type": "match"
}
],
"properties": []
}

BIN
needles/cockpit/main.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -0,0 +1,15 @@
{
"properties": [],
"area": [
{
"xpos": 19,
"ypos": 181,
"width": 50,
"height": 13,
"type": "match"
}
],
"tags": [
"cockpit_services"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 580,
"ypos": 482,
"width": 81,
"height": 14,
"type": "match"
}
],
"tags": [
"cockpit_services_auditd"
],
"properties": []
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View File

@ -0,0 +1,15 @@
{
"properties": [],
"tags": [
"cockpit_services_auditd_detail"
],
"area": [
{
"xpos": 215,
"ypos": 325,
"width": 319,
"height": 13,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -0,0 +1,22 @@
{
"properties": [],
"area": [
{
"xpos": 771,
"ypos": 41,
"width": 20,
"height": 20,
"type": "match"
},
{
"xpos": 887,
"ypos": 40,
"width": 24,
"height": 20,
"type": "match"
}
],
"tags": [
"firefox"
]
}

BIN
needles/firefox/firefox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

View File

@ -325,6 +325,28 @@
},
test_suite => { name => "server_realmd_join_kickstart" },
},
{
machine => { name => "64bit" },
prio => 40,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "Server-dvd-iso",
version => "*",
},
test_suite => { name => "server_cockpit_default" },
},
{
machine => { name => "64bit" },
prio => 40,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "Server-dvd-iso",
version => "*",
},
test_suite => { name => "server_cockpit_basic" },
},
{
machine => { name => "64bit" },
prio => 20,
@ -1657,6 +1679,29 @@
{ key => "WORKER_CLASS", value => "tap" },
],
},
{
name => "server_cockpit_default",
settings => [
{ key => "POSTINSTALL", value => "server_cockpit_default" },
{ key => "USER_LOGIN", value => "false" },
{ key => "ROOT_PASSWORD", value => "weakpassword" },
{ key => "START_AFTER_TEST", value => "install_default_upload" },
{ key => "BOOTFROM", value => "c" },
{ key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" },
{ key => "STORE_HDD_1", value => "disk_%MACHINE%_cockpit.qcow2" },
],
},
{
name => "server_cockpit_basic",
settings => [
{ key => "POSTINSTALL", value => "server_cockpit_basic" },
{ key => "USER_LOGIN", value => "false" },
{ key => "ROOT_PASSWORD", value => "weakpassword" },
{ key => "START_AFTER_TEST", value => "server_cockpit_default" },
{ key => "BOOTFROM", value => "c" },
{ key => "HDD_1", value => "disk_%MACHINE%_cockpit.qcow2" },
],
},
{
name => "desktop_terminal",
settings => [

View File

@ -0,0 +1,38 @@
use base "installedtest";
use strict;
use testapi;
sub run {
my $self=shift;
# run firefox and login to cockpit
$self->start_cockpit(1);
# go to the logs screen
assert_and_click "cockpit_logs";
# the date dropdown changes and messes with the button locations, so wait
wait_still_screen 2;
assert_and_click "cockpit_logs_notices";
wait_still_screen 2;
# assume there's an entry, click it
assert_and_click "cockpit_logs_notices_entry";
# check we get to the appropriate detail screen
assert_screen "cockpit_logs_notices_detail";
# go to the services screen
assert_and_click "cockpit_services";
wait_still_screen 2;
# assume auditd is there, click it
assert_and_click "cockpit_services_auditd";
# check we get to the appropriate detail screen
assert_screen "cockpit_services_auditd_detail";
}
sub test_flags {
# without anything - rollback to 'lastgood' snapshot if failed
# 'fatal' - whole test suite is in danger if this fails
# 'milestone' - after this test succeeds, update 'lastgood'
# 'important' - if this fails, set the overall state to 'fail'
return { fatal => 1 };
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,31 @@
use base "installedtest";
use strict;
use testapi;
sub run {
my $self=shift;
# check cockpit appears to be enabled and running and firewall is setup
assert_script_run 'systemctl is-enabled cockpit.socket';
assert_script_run 'systemctl is-active cockpit.socket';
assert_script_run 'firewall-cmd --query-service cockpit';
# we don't want updates-testing for validation purposes
assert_script_run 'dnf config-manager --set-disabled updates-testing';
# install a desktop and firefox so we can actually try it
assert_script_run 'dnf -y groupinstall "base-x"', 300;
assert_script_run 'dnf -y install firefox', 120;
$self->start_cockpit(0);
# quit firefox (return to console)
send_key "ctrl-q";
}
sub test_flags {
# without anything - rollback to 'lastgood' snapshot if failed
# 'fatal' - whole test suite is in danger if this fails
# 'milestone' - after this test succeeds, update 'lastgood'
# 'important' - if this fails, set the overall state to 'fail'
return { fatal => 1 };
}
1;
# vim: set sw=4 et: