mirror of
https://github.com/rocky-linux/os-autoinst-distri-rocky.git
synced 2024-12-30 14:20:55 +00:00
dcb68d93c8
Summary: os-autoinst implements `script_run` itself now, we aren't required to implement it ourselves any more. os-autoinst's implementation is better than ours, as it allows for verifying the script actually ran (via the redirect-output-to-serial- console trick). So this drops our implementation so we'll just use the upstream one. Where I judged we don't want to bother with the 'check the command actually ran' feature I've adjusted our direct `script_run` calls to pass a wait time of 0, which skips the 'wait for command to run' stuff entirely and just does a simple 'type the string and hit enter'. Because of how the inheritance works, our `assert_script_run` calls already used the os-autoinst `script_run`, rather than the one from our distribution. This should prevent `prepare_test_packages` sometimes going wrong right after removing the python3-kickstart package, as we'll properly wait for that removal to complete now (before we weren't, we'd just start typing the next command while it was still running, which could result in lost keypresses). Test Plan: Check all tests still run OK (I've tried this on staging and it seems fine). Reviewers: jskladan, garretraziel Reviewed By: garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1034
40 lines
1.6 KiB
Perl
40 lines
1.6 KiB
Perl
package packagetest;
|
|
|
|
use strict;
|
|
|
|
use base 'Exporter';
|
|
use Exporter;
|
|
|
|
use testapi;
|
|
our @EXPORT = qw/prepare_test_packages verify_installed_packages verify_updated_packages/;
|
|
|
|
# enable the openqa test package repositories and install the main
|
|
# test packages, remove python3-kickstart and install the fake one
|
|
sub prepare_test_packages {
|
|
# remove python3-kickstart if installed (we don't use assert
|
|
# here in case it's not)
|
|
script_run 'dnf -y remove python3-kickstart', 180;
|
|
# we seem to often lose keystrokes in the next command if we run
|
|
# it too fast, let's wait for idle first
|
|
wait_idle 20;
|
|
# grab the test repo definitions
|
|
assert_script_run 'curl -o /etc/yum.repos.d/openqa-testrepo-1.repo https://fedorapeople.org/groups/qa/openqa-repos/openqa-testrepo-1.repo';
|
|
# install the test packages from repo1
|
|
assert_script_run 'dnf -y --disablerepo=* --enablerepo=openqa-testrepo-1 install python3-kickstart';
|
|
}
|
|
|
|
# check our test packages installed correctly (this is a test that dnf
|
|
# actually does what it claims)
|
|
sub verify_installed_packages {
|
|
validate_script_output 'rpm -q python3-kickstart', sub { $_ =~ m/^python3-kickstart-1.1.noarch$/ };
|
|
assert_script_run 'rpm -V python3-kickstart';
|
|
}
|
|
|
|
# check updating the test packages and the fake python3-kickstart work
|
|
# as expected
|
|
sub verify_updated_packages {
|
|
# we don't know what version of python3-kickstart we'll actually
|
|
# get, so just check it's *not* the fake one
|
|
validate_script_output 'rpm -q python3-kickstart', sub { $_ !~ m/^python3-kickstart-1-1.noarch$/ };
|
|
assert_script_run 'rpm -V python3-kickstart';
|
|
}
|