Skip to content

Commit

Permalink
Introduce new function to apply minimal patch
Browse files Browse the repository at this point in the history
  • Loading branch information
mitiao committed Dec 13, 2016
1 parent ba6aba2 commit 555da31
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 15 deletions.
13 changes: 13 additions & 0 deletions lib/utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ our @EXPORT = qw/
get_netboot_mirror
zypper_call
fully_patch_system
minimal_patch_system
workaround_type_encrypted_passphrase
ensure_unlocked_desktop
sle_version_at_least
Expand Down Expand Up @@ -316,6 +317,18 @@ sub fully_patch_system {
zypper_call('patch --with-interactive -l', exitcode => [0, 102], timeout => 6000);
}

# zypper doesn't offer --updatestack-only option before 12-SP1, use patch for sp0 to update packager
sub minimal_patch_system {
my (%args) = @_;
$args{version_variable} //= 'VERSION';
if (sle_version_at_least('12-SP1', version_variable => $args{version_variable})) {
zypper_call('patch --with-interactive -l --updatestack-only', exitcode => [0, 102, 103], timeout => 1500, log => 'minimal_patch.log');
}
else {
zypper_call('patch --with-interactive -l', exitcode => [0, 102, 103], timeout=> 1500, log => 'minimal_patch.log');
}
}

sub workaround_type_encrypted_passphrase {
if (check_var('ARCH', 'ppc64le') && (get_var('ENCRYPT') && !get_var('ENCRYPT_ACTIVATE_EXISTING') || get_var('ENCRYPT_FORCE_RECOMPUTE'))) {
record_soft_failure 'workaround https://fate.suse.com/320901' if sle_version_at_least('12-SP3');
Expand Down
4 changes: 2 additions & 2 deletions products/sle/main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -920,9 +920,9 @@ sub load_online_migration_tests() {
loadtest "online_migration/sle12_online_migration/online_migration_setup";
loadtest "online_migration/sle12_online_migration/register_system";
loadtest "online_migration/sle12_online_migration/repos_check";
# do full update before migration
# otherwise yast2/zypper migration will patch a minimal update
# do full/minimal update before migration
loadtest "online_migration/sle12_online_migration/zypper_patch" if (get_var("FULL_UPDATE"));
loadtest "online_migration/sle12_online_migration/minimal_patch" if (get_var("MINIMAL_UPDATE"));
loadtest "online_migration/sle12_online_migration/pre_migration";
loadtest "online_migration/sle12_online_migration/yast2_migration" if (check_var("MIGRATION_METHOD", 'yast'));
loadtest "online_migration/sle12_online_migration/zypper_migration" if (check_var("MIGRATION_METHOD", 'zypper'));
Expand Down
28 changes: 28 additions & 0 deletions tests/online_migration/sle12_online_migration/minimal_patch.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# SLE12 online migration tests
#
# Copyright © 2016 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.

# Summary: sle12 online migration testsuite
# Maintainer: mitiao <mitiao@gmail.com>

use base "consoletest";
use strict;
use testapi;
use utils;

sub run() {
select_console 'root-console';
minimal_patch_system(version_variable => 'HDDVERSION');
}

sub test_flags() {
return {fatal => 1};
}

1;
# vim: set sw=4 et:
15 changes: 4 additions & 11 deletions tests/online_migration/sle12_online_migration/pre_migration.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,8 @@
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.

# G-Summary: Add sle12 online migration testsuite
# Fixes follow up by the comments
#
# Apply fully patch system function
#
# Fix typo and remove redundant comment
#
# Remove a unnecessary line
# G-Maintainer: mitiao <mitiao@gmail.com>
# Summary: sle12 online migration testsuite
# Maintainer: mitiao <mitiao@gmail.com>

use base "consoletest";
use strict;
Expand All @@ -30,8 +23,8 @@ sub set_scc_proxy_url() {
}

sub check_or_install_packages() {
if (get_var("FULL_UPDATE")) {
# if system is fully updated, all necessary packages for online migration should be installed
if (get_var("FULL_UPDATE") || get_var("MINIMAL_UPDATE")) {
# if system is fully updated or even minimal patch applied, all necessary packages for online migration should be installed
# check if the packages was installed along with update
my $output = script_output "rpm -qa yast2-migration zypper-migration-plugin rollback-helper | sort";
if ($output !~ /rollback-helper.*?yast2-migration.*?zypper-migration-plugin/s) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ sub run {

script_run("/sbin/yast2 migration; echo yast2-migration-done-\$? > /dev/$serialdev", 0);

# install minimal update before migration if not perform full update
if (!get_var("FULL_UPDATE")) {
# yast2 migration would check and install minimal update before migration
# if the system doesn't perform full update or minimal update
if (!(get_var("FULL_UPDATE") || get_var("MINIMAL_UPDATE"))) {
assert_screen 'yast2-migration-onlineupdates';
send_key "alt-y";
assert_screen 'yast2-migration-updatesoverview';
Expand Down

0 comments on commit 555da31

Please sign in to comment.