Skip to content

Commit

Permalink
Add tests for test module flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodion Iafarov committed Oct 2, 2018
1 parent 68e8966 commit 8e13bc1
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 2 deletions.
30 changes: 29 additions & 1 deletion t/fixtures/01-jobs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -491,5 +491,33 @@
{key => 'ISO_MAXSIZE', value => '4700372992'},
{key => 'ISO', value => 'openSUSE-13.1-DVD-x86_64-Build0091-Media.iso'},
{key => 'DVD', value => '1'},
]}]
]
},
## Job 99764 is used to test test module flags (milestone, fatal, etc.)
Jobs => {
id => 99764,
priority => 35,
result => "passed",
state => "done",
t_finished => time2str('%Y-%m-%d %H:%M:%S', time - 13800, 'UTC'), # Finished 3 hours 50 minutes ago
t_started => time2str('%Y-%m-%d %H:%M:%S', time - 14100, 'UTC'), # Took 5 minutes
t_created => time2str('%Y-%m-%d %H:%M:%S', time - 14400, 'UTC'), # Four hours ago
TEST => "console tests",
BUILD => '0091',
DISTRI => 'opensuse',
FLAVOR => 'DVD',
MACHINE => '64bit',
VERSION => '13.1',
backend => 'qemu',
jobs_assets => [{asset_id => 2},],
ARCH => 'x86_64',
settings => [
{key => 'DESKTOP', value => 'textmode'},
{key => 'ISO_MAXSIZE', value => '4700372992'},
{key => 'ISO', value => 'openSUSE-13.1-DVD-x86_64-Build0091-Media.iso'},
{key => 'DVD', value => '1'}
],
result_dir => '00099764-opensuse-13.1-DVD-x86_64-Build0091-kde',
},
]
# vim: set sw=4 et:
36 changes: 35 additions & 1 deletion t/fixtures/05-job_modules.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1627,4 +1627,38 @@
category => 'x11',
name => 'shutdown',
result => 'none',
}]
},
JobModules => {
script => 'tests/console/yast2_lan.pm',
job_id => 99764,
category => 'console',
name => 'yast2_lan',
always_rollback => 1,
important => 1,
result => 'passed',
},
JobModules => {
script => 'tests/console/yast2_bootloader.pm',
job_id => 99764,
category => 'console',
name => 'yast2_bootloader',
result => 'passed',
milestone => 1,
important => 1,
},
JobModules => {
script => 'tests/console/sshd.pm',
job_id => 99764,
category => 'console',
name => 'sshd',
result => 'passed',
fatal => '1',
},
JobModules => {
script => 'tests/console/textinfo.pm',
job_id => 99764,
category => 'console',
name => 'textinfo',
result => 'passed',
},
]
23 changes: 23 additions & 0 deletions t/ui/18-tests-details.t
Original file line number Diff line number Diff line change
Expand Up @@ -430,5 +430,28 @@ like($worker_text[0], qr/[ \n]*Assigned worker:[ \n]*localhost:1[ \n]*/, 'worker
# warnings
$get = $t->get_ok('/tests/80000')->status_is(200);

subtest 'test module flags are displayed correctly' => sub {
# for this job we have exactly each flag set once, so check that not to rely on the order of the test modules
$driver->get('/tests/99764');
my $flags = $driver->find_elements("//div[\@class='flags']/i[(starts-with(\@class, 'flag fa fa-'))]", 'xpath');
is(scalar(@{$flags}), 4, 'Expect 4 flags in the job 99764');

my $flag = $driver->find_element("//div[\@class='flags']/i[\@class='flag fa fa-minus']", 'xpath');
ok($flag, 'Ignore failure flag is displayed for test modules which are not important, neither fatal');
is($flag->get_attribute('title'), 'Ignore failure: failure or soft failure of this test does not impact overall job result', 'Description of Ignore failure flag is correct');

$flag = $driver->find_element("//div[\@class='flags']/i[\@class='flag fa fa-redo']", 'xpath');
ok($flag, 'Always rollback flag is displayed correctly');
is($flag->get_attribute('title'), 'Always rollback: revert to the last milestone snapshot even if test module is successful', 'Description of always_rollback flag is correct');

$flag = $driver->find_element("//div[\@class='flags']/i[\@class='flag fa fa-anchor']", 'xpath');
ok($flag, 'Milestone flag is displayed correctly');
is($flag->get_attribute('title'), 'Milestone: snapshot the state after this test for restoring', 'Description of milestone flag is correct');

$flag = $driver->find_element("//div[\@class='flags']/i[\@class='flag fa fa-plug']", 'xpath');
ok($flag, 'Fatal flag is displayed correctly');
is($flag->get_attribute('title'), 'Fatal: testsuite is aborted if this test fails', 'Description of fatal flag is correct');
};

kill_driver();
done_testing();

0 comments on commit 8e13bc1

Please sign in to comment.