Skip to content

Commit

Permalink
Merge pull request #2563 from mimi1vx/extend_qam-minimal
Browse files Browse the repository at this point in the history
Extension for qam-minimal tests (poo#17412)
  • Loading branch information
dzedro committed Mar 21, 2017
2 parents 1a7952b + e5dca02 commit 181d52b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
22 changes: 20 additions & 2 deletions tests/qam-minimal/install_patterns.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,27 @@ use utils;
use qam;
use testapi;

sub install_packages {
my $patch_info = shift;
my $pattern = qr/\s+(.+)(?!\.src)\..*\s<\s.*/;

# loop over packages in patchinfo and try installation
foreach my $line (split(/\n/, $patch_info)) {
if (my ($package) = $line =~ $pattern) {
script_run("zypper -n in $package", 700);
save_screenshot;
}
}
}

sub run {
my ($self) = @_;
my $patch = get_required_var('INCIDENT_PATCH');

select_console 'root-console';

pkcon_quit;

zypper_call("ref");

zypper_call("pt");
save_screenshot;

Expand All @@ -45,6 +58,11 @@ sub run {
# now we have gnome installed - restore DESKTOP variable
set_var('DESKTOP', get_var('FULL_DESKTOP'));

my $patch_status = script_output("zypper -n info -t patch $patch");
if ($patch_status =~ /Status\s+:\s+not\sneeded/) {
install_packages($patch_status);
}

prepare_system_reboot;
type_string "reboot\n";
$self->wait_boot;
Expand Down
32 changes: 23 additions & 9 deletions tests/qam-minimal/install_update.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,38 @@ sub run {
my ($self) = @_;
select_console 'root-console';

if (!get_var('INCIDENT_REPO')) {
die "no repository with update";
}
my $patch = get_required_var('INCIDENT_PATCH');

capture_state('before');

my $repo = get_var('INCIDENT_REPO');
my $repo = get_required_var('INCIDENT_REPO');
zypper_call("ar -f $repo test-minimal");

zypper_call("ref");

zypper_call('in -l -t patch ' . get_var('INCIDENT_PATCH'), exitcode => [0, 102, 103], log => 'zypper.log');
# test if is patch needed and record_info
my $patch_status = script_output("zypper -n info -t patch $patch");
# record softfail on QAM_MINIMAL=small tests, or record info on others
# if isn't patch neded, zypper call with install makes no sense
if ($patch_status =~ /Status\s+:\s+not\sneeded/) {
if (check_var('QAM_MINIMAL', 'small')) {
record_soft_failure("Patch isn't needed on minimal installation poo#17412");
}
else {
record_info('Not needed', q{Patch doesn't fix any package in minimal pattern});
}
}
else {
zypper_call("in -l -t patch $patch", exitcode => [0, 102, 103], log => 'zypper.log');

save_screenshot;

capture_state('between', 1);
capture_state('between', 1);

prepare_system_reboot;
type_string "reboot\n";
$self->wait_boot;
prepare_system_reboot;
type_string "reboot\n";
$self->wait_boot;
}
}

sub test_flags {
Expand Down

0 comments on commit 181d52b

Please sign in to comment.