1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-12-22 02:13:08 +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:
Adam Williamson 2016-01-12 09:27:14 -08:00
parent 63e03ecbdf
commit aa20bab713
6 changed files with 8 additions and 8 deletions

View File

@ -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/ };
}

View File

@ -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!/ };
}

View File

@ -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!/ };
}

View File

@ -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!/ };
}

View File

@ -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 {

View File

@ -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;
}