mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2024-11-21 21:43:08 +00:00
cockpit: don't try and get admin privs when re-logging in
There's one point in the tests where we may log into cockpit for the second time in one run (it depends how a package update process goes). When this happens, we don't get prompted again for admin access, so we need to *not* expect that. Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
parent
2c6e1ec76b
commit
9d8a35ed39
@ -13,8 +13,12 @@ our @EXPORT = qw(start_cockpit select_cockpit_update check_updates);
|
|||||||
|
|
||||||
sub start_cockpit {
|
sub start_cockpit {
|
||||||
# Starting from a console, get to a browser with Cockpit (running
|
# Starting from a console, get to a browser with Cockpit (running
|
||||||
# on localhost) shown. If $login is truth-y, also log in. Assumes
|
# on localhost) shown. If login is truth-y, also log in. If login
|
||||||
|
# and admin are both truthy, also gain admin privileges. Assumes
|
||||||
# X and Firefox are installed.
|
# X and Firefox are installed.
|
||||||
|
my %args = @_;
|
||||||
|
$args{login} //= 0;
|
||||||
|
$args{admin} //= 1;
|
||||||
my $login = shift || 0;
|
my $login = shift || 0;
|
||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1439429
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1439429
|
||||||
assert_script_run "sed -i -e 's,enable_xauth=1,enable_xauth=0,g' /usr/bin/startx";
|
assert_script_run "sed -i -e 's,enable_xauth=1,enable_xauth=0,g' /usr/bin/startx";
|
||||||
@ -24,15 +28,17 @@ sub start_cockpit {
|
|||||||
type_string "startx /usr/bin/firefox -width 1024 -height 768 http://localhost:9090\n";
|
type_string "startx /usr/bin/firefox -width 1024 -height 768 http://localhost:9090\n";
|
||||||
assert_screen "cockpit_login", 60;
|
assert_screen "cockpit_login", 60;
|
||||||
wait_still_screen(stilltime => 5, similarity_level => 45);
|
wait_still_screen(stilltime => 5, similarity_level => 45);
|
||||||
if ($login) {
|
if ($args{login}) {
|
||||||
type_safely "test";
|
type_safely "test";
|
||||||
wait_screen_change { send_key "tab"; };
|
wait_screen_change { send_key "tab"; };
|
||||||
type_safely get_var("USER_PASSWORD", "weakpassword");
|
type_safely get_var("USER_PASSWORD", "weakpassword");
|
||||||
send_key "ret";
|
send_key "ret";
|
||||||
|
if ($args{admin}) {
|
||||||
assert_and_click "cockpit_admin_enable";
|
assert_and_click "cockpit_admin_enable";
|
||||||
assert_screen "cockpit_admin_password";
|
assert_screen "cockpit_admin_password";
|
||||||
type_safely get_var("USER_PASSWORD", "weakpassword");
|
type_safely get_var("USER_PASSWORD", "weakpassword");
|
||||||
send_key "ret";
|
send_key "ret";
|
||||||
|
}
|
||||||
assert_screen "cockpit_main";
|
assert_screen "cockpit_main";
|
||||||
# wait for any animation or other weirdness
|
# wait for any animation or other weirdness
|
||||||
# can't use wait_still_screen because of that damn graph
|
# can't use wait_still_screen because of that damn graph
|
||||||
|
@ -31,7 +31,7 @@ sub run {
|
|||||||
# note: we can't use wait_screen_change, wait_still_screen or
|
# note: we can't use wait_screen_change, wait_still_screen or
|
||||||
# check_type_string in cockpit because of that fucking constantly
|
# check_type_string in cockpit because of that fucking constantly
|
||||||
# scrolling graph
|
# scrolling graph
|
||||||
start_cockpit(1);
|
start_cockpit(login => 1);
|
||||||
# to activate the right pane
|
# to activate the right pane
|
||||||
assert_and_click "cockpit_main";
|
assert_and_click "cockpit_main";
|
||||||
send_key "pgdn";
|
send_key "pgdn";
|
||||||
|
@ -9,7 +9,7 @@ sub run {
|
|||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
# Start Cockpit
|
# Start Cockpit
|
||||||
start_cockpit(1);
|
start_cockpit(login => 1);
|
||||||
|
|
||||||
# Navigate to the Update screen
|
# Navigate to the Update screen
|
||||||
select_cockpit_update();
|
select_cockpit_update();
|
||||||
|
@ -7,7 +7,7 @@ use cockpit;
|
|||||||
sub run {
|
sub run {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
# run firefox and login to cockpit
|
# run firefox and login to cockpit
|
||||||
start_cockpit(1);
|
start_cockpit(login => 1);
|
||||||
# go to the logs screen
|
# go to the logs screen
|
||||||
assert_and_click "cockpit_logs";
|
assert_and_click "cockpit_logs";
|
||||||
# the date dropdown changes and messes with the button locations, so wait
|
# the date dropdown changes and messes with the button locations, so wait
|
||||||
|
@ -11,7 +11,7 @@ sub run {
|
|||||||
assert_script_run 'systemctl is-active cockpit.socket';
|
assert_script_run 'systemctl is-active cockpit.socket';
|
||||||
assert_script_run 'firewall-cmd --query-service cockpit';
|
assert_script_run 'firewall-cmd --query-service cockpit';
|
||||||
# test cockpit web UI start
|
# test cockpit web UI start
|
||||||
start_cockpit(0);
|
start_cockpit(login => 0);
|
||||||
# quit firefox (return to console)
|
# quit firefox (return to console)
|
||||||
quit_firefox;
|
quit_firefox;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ sub run {
|
|||||||
verify_installed_packages;
|
verify_installed_packages;
|
||||||
|
|
||||||
# Start Cockpit
|
# Start Cockpit
|
||||||
start_cockpit(1);
|
start_cockpit(login => 1);
|
||||||
# Navigate to update screen
|
# Navigate to update screen
|
||||||
select_cockpit_update();
|
select_cockpit_update();
|
||||||
|
|
||||||
@ -43,12 +43,13 @@ sub run {
|
|||||||
# When Cockpit packages are also included in the updates
|
# When Cockpit packages are also included in the updates
|
||||||
# the user is forced to reconnect, i.e. to restart the Web Application
|
# the user is forced to reconnect, i.e. to restart the Web Application
|
||||||
# and relog for further interaction. We will check if reconnection is
|
# and relog for further interaction. We will check if reconnection is
|
||||||
# needed and if so, we will restart Firefox and login again.
|
# needed and if so, we will restart Firefox and login again. We do
|
||||||
|
# *not* need to gain admin privs again, trying to do so will fail.
|
||||||
#
|
#
|
||||||
last if (check_screen("cockpit_updates_updated"));
|
last if (check_screen("cockpit_updates_updated"));
|
||||||
if (check_screen("cockpit_updates_reconnect", 1)) {
|
if (check_screen("cockpit_updates_reconnect", 1)) {
|
||||||
quit_firefox;
|
quit_firefox;
|
||||||
start_cockpit(1);
|
start_cockpit(login => 1, admin => 0);
|
||||||
select_cockpit_update();
|
select_cockpit_update();
|
||||||
last;
|
last;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user