Force GNOME to notify updates, re-enable test on Workstation

Summary:
GNOME's update notification criteria are pretty braindead: it
fires the update check timer once on login then once every hour
thereafter, but only actually checks for and notifies of updates
once a day if it's after 6am(?!?!?!). So we have to do a bunch
of fiddling around to ensure we reliably get a notification.
Move the clock to 6am if it's earlier than that, and reset the
'last update check' timer to 48 hours ago, then log in to GNOME
after that.

Note: I thought this still wasn't fully reliable, but I've looked
into all the recent failures of either test on staging and
there's only one which was really 'no update notification came
up', and the logs clearly indicate PK did run an update check,
so I don't think that was a test bug (I think something went
wrong with the update check). The other failures are all 'GNOME
did something wacky', plus one case where the needle didn't quite
match because I think the match area is slightly too tall; I'll
fix that in a second.

Test Plan:
Run the tests on both KDE and GNOME and check they
work properly now (assuming nothing unrelated breaks, like KDE
crashing...)

Reviewers: jskladan, garretraziel

Reviewed By: garretraziel

Subscribers: tflink

Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1039
This commit is contained in:
Adam Williamson 2016-10-27 16:23:59 -07:00
parent 638aa01de2
commit 7b31b8263e
4 changed files with 79 additions and 18 deletions

View File

@ -8,11 +8,11 @@
"ypos": 95 "ypos": 95
}, },
{ {
"height": 17, "height": 14,
"type": "match", "type": "match",
"width": 17, "width": 17,
"xpos": 136, "xpos": 136,
"ypos": 93 "ypos": 96
} }
], ],
"tags": [ "tags": [
@ -21,4 +21,4 @@
"ENV-DISTRI-fedora", "ENV-DISTRI-fedora",
"ENV-FLAVOR-server" "ENV-FLAVOR-server"
] ]
} }

View File

@ -1,15 +1,15 @@
{ {
"area": [ "area": [
{ {
"height": 95, "height": 92,
"type": "match", "type": "match",
"width": 40, "width": 40,
"xpos": 170, "xpos": 170,
"ypos": 90 "ypos": 94
} }
], ],
"tags": [ "tags": [
"desktop_update_notification_only", "desktop_update_notification_only",
"DESKTOP-gnome" "DESKTOP-gnome"
] ]
} }

View File

@ -369,6 +369,17 @@
}, },
test_suite => { name => "desktop_browser" }, test_suite => { name => "desktop_browser" },
}, },
{
machine => { name => "64bit" },
prio => 30,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "Workstation-live-iso",
version => "*",
},
test_suite => { name => "desktop_notifications_live" },
},
{ {
machine => { name => "64bit" }, machine => { name => "64bit" },
prio => 32, prio => 32,
@ -380,6 +391,17 @@
}, },
test_suite => { name => "desktop_notifications_live" }, test_suite => { name => "desktop_notifications_live" },
}, },
{
machine => { name => "64bit" },
prio => 30,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "Workstation-live-iso",
version => "*",
},
test_suite => { name => "desktop_notifications_postinstall" },
},
{ {
machine => { name => "64bit" }, machine => { name => "64bit" },
prio => 32, prio => 32,
@ -2169,7 +2191,7 @@
{ {
name => "desktop_notifications_postinstall", name => "desktop_notifications_postinstall",
settings => [ settings => [
{ key => "POSTINSTALL", value => "desktop_notifications" }, { key => "ENTRYPOINT", value => "desktop_notifications" },
{ key => "START_AFTER_TEST", value => "install_default_upload" }, { key => "START_AFTER_TEST", value => "install_default_upload" },
{ key => "BOOTFROM", value => "c" }, { key => "BOOTFROM", value => "c" },
{ key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" }, { key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" },

View File

@ -12,27 +12,66 @@ use packagetest;
sub run { sub run {
my $self = shift; my $self = shift;
my $desktop = get_var("DESKTOP");
# for the live image case, handle bootloader here # for the live image case, handle bootloader here
unless (get_var("BOOTFROM")) { if (get_var("BOOTFROM")) {
$self->do_bootloader(postinstall=>0); $self->do_bootloader(postinstall=>1, params=>'3');
} }
assert_screen "graphical_desktop_clean", 300; else {
# ensure we actually have some package updates available $self->do_bootloader(postinstall=>0, params=>'3');
# we're kinda theoretically racing with the update check here, }
# but we have no great way to handle that especially live; let's boot_to_login_screen;
# just assume we're gonna win
$self->root_console(tty=>3); $self->root_console(tty=>3);
# ensure we actually have some package updates available
prepare_test_packages; prepare_test_packages;
desktop_vt; if ($desktop eq 'gnome') {
# On GNOME, move the clock forward if needed, because it won't
# check for updates before 6am(!)
my $hour = script_output 'date +%H';
if ($hour < 6) {
script_run 'systemctl stop chronyd.service ntpd.service';
script_run 'systemctl disable chronyd.service ntpd.service';
script_run 'systemctl mask chronyd.service ntpd.service';
assert_script_run 'date --set="06:00:00"';
}
if (get_var("BOOTFROM")) {
# Also reset the 'last update notification check' timestamp
# to >24 hours ago (as that matters too)
my $now = script_output 'date +%s';
my $yday = $now - 48*60*60;
# have to log in as the user to do this
script_run 'exit', 0;
console_login(user=>get_var('USER_LOGIN', 'test'), password=>get_var('USER_PASSWORD', 'weakpassword'));
script_run "gsettings set org.gnome.software check-timestamp ${yday}", 0;
wait_still_screen 3;
script_run "gsettings get org.gnome.software check-timestamp", 0;
wait_still_screen 3;
script_run 'exit', 0;
console_login(user=>'root', password=>get_var('ROOT_PASSWORD', 'weakpassword'));
}
}
assert_script_run 'systemctl isolate graphical.target';
send_key 'ctrl-alt-f1';
if (get_var("BOOTFROM")) {
assert_screen 'graphical_login';
wait_still_screen 3;
if (get_var("DESKTOP") eq 'gnome') {
# we have to hit enter to get the password dialog
send_key "ret";
}
assert_screen "graphical_login_input";
type_very_safely get_var("USER_PASSWORD", "weakpassword");
send_key 'ret';
}
assert_screen 'graphical_desktop_clean', 90;
# now, WE WAIT. this is just an unconditional wait - rather than # now, WE WAIT. this is just an unconditional wait - rather than
# breaking if we see an update notification appear - so we catch # breaking if we see an update notification appear - so we catch
# things that crash a few minutes after startup, etc. # things that crash a few minutes after startup, etc.
for my $n (1..5) { for my $n (1..20) {
sleep 120; sleep 30;
mouse_set 10, 10; mouse_set 10, 10;
mouse_hide; mouse_hide;
} }
my $desktop = get_var("DESKTOP");
if ($desktop eq 'gnome') { if ($desktop eq 'gnome') {
# of course, we have no idea what'll be in the clock, so we just # of course, we have no idea what'll be in the clock, so we just
# have to click where we know it is # have to click where we know it is