mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2024-11-24 14:53:09 +00:00
use assert_script_run when possible
Summary:
D637 / ec6b3ff4
switched from using needle matches to using
validate_script_output when we want to run a console command
and check the result. validate_script_output is kinda over-
powered when all you want to do is check the command succeeded
(returned 0), though. testapi provides assert_script_run for
doing exactly that - it runs a script and fails if the script
fails (returns anything but 0). This gives us cleaner code and
is slightly more robust; validate_script_output uses the mini
web server on the worker, which I've occasionally seen crap
out, so it seems good to avoid using it when possible. assert_
script_run doesn't need it.
Test Plan: Check all (affected) tests still work properly.
Reviewers: jskladan, garretraziel
Reviewed By: jskladan, garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D714
This commit is contained in:
parent
63e03ecbdf
commit
aa20bab713
@ -5,7 +5,7 @@ use testapi;
|
||||
sub run {
|
||||
assert_screen "root_console";
|
||||
# mount second partition and check that it's intact
|
||||
validate_script_output 'mount /dev/vda2 /mnt; echo $?', sub { $_ =~ m/0/ };
|
||||
assert_script_run 'mount /dev/vda2 /mnt';
|
||||
validate_script_output 'cat /mnt/testfile', sub { $_ =~ m/Oh, hi Mark/ };
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ use testapi;
|
||||
sub run {
|
||||
assert_screen "root_console";
|
||||
# check that first partition is intact
|
||||
validate_script_output 'mount /dev/vda1 /mnt; echo $?', sub { $_ =~ m/0/ };
|
||||
assert_script_run 'mount /dev/vda1 /mnt';
|
||||
validate_script_output 'cat /mnt/testfile', sub { $_ =~ m/Hello, world!/ };
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ use testapi;
|
||||
sub run {
|
||||
assert_screen "root_console";
|
||||
# check that second disk is intact
|
||||
validate_script_output 'mount /dev/sdb1 /mnt; echo $?', sub { $_ =~ m/0/ };
|
||||
assert_script_run 'mount /dev/sdb1 /mnt';
|
||||
validate_script_output 'cat /mnt/testfile', sub { $_ =~ m/Hello, world!/ };
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ use testapi;
|
||||
sub run {
|
||||
assert_screen "root_console";
|
||||
# mount first partition and check that it's intact
|
||||
validate_script_output 'mount /dev/vda1 /mnt; echo $?', sub { $_ =~ m/0/ };
|
||||
assert_script_run 'mount /dev/vda1 /mnt';
|
||||
validate_script_output 'cat /mnt/testfile', sub { $_ =~ m/Hello, world!/ };
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ sub run {
|
||||
}
|
||||
assert_screen "root_console";
|
||||
# this test shows if the system is booted with efi
|
||||
validate_script_output '[ -d /sys/firmware/efi/ ]; echo $?', sub { $_ =~ m/0/ };
|
||||
assert_script_run '[ -d /sys/firmware/efi/ ]';
|
||||
}
|
||||
|
||||
sub test_flags {
|
||||
|
@ -18,7 +18,7 @@ sub run {
|
||||
|
||||
# upgrader should be installed on up-to-date system
|
||||
|
||||
validate_script_output 'dnf -y update; echo $?', sub { $_ =~ m/0/ }, 1800;
|
||||
assert_script_run 'dnf -y update', 1800;
|
||||
|
||||
script_run "reboot";
|
||||
|
||||
@ -29,8 +29,8 @@ sub run {
|
||||
}
|
||||
$self->root_console(tty=>3);
|
||||
|
||||
my $update_command = 'dnf -y --enablerepo=updates-testing install dnf-plugin-system-upgrade; echo $?';
|
||||
validate_script_output $update_command, sub { $_ =~ m/0/ }, 1800;
|
||||
my $update_command = 'dnf -y --enablerepo=updates-testing install dnf-plugin-system-upgrade';
|
||||
assert_script_run $update_command, 1800;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user