From 6d7fffc069dcc7a764753769359cdbaac2590d30 Mon Sep 17 00:00:00 2001 From: Anton Smorodskyi Date: Fri, 14 Jun 2024 16:39:03 +0200 Subject: [PATCH] Create zypper resolver and upload it --- lib/utils.pm | 23 ++++++++++++++++++----- variables.md | 1 + 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/utils.pm b/lib/utils.pm index 548b3709f8fb..31a06d965466 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -832,16 +832,29 @@ the second run will update the system. sub ssh_fully_patch_system { my $remote = shift; my $cmd_time = time(); + my $resolver_option = get_var('PUBLIC_CLOUD_GEN_RESOLVER') ? '--debug-solver' : ''; + my $cmd = "ssh $remote 'sudo zypper -n patch $resolver_option --with-interactive -l'"; # first run, possible update of packager -- exit code 103 - my $ret = script_run("ssh $remote 'sudo zypper -n patch --with-interactive -l'", 1500); + my $ret = script_run($cmd, 1500); record_info('zypper patch', 'The command zypper patch took ' . (time() - $cmd_time) . ' seconds.'); - die "Zypper failed with $ret" if ($ret != 0 && $ret != 102 && $ret != 103); - + if ($ret != 0 && $ret != 102 && $ret != 103) { + if ($resolver_option) { + script_run("ssh $remote 'tar -czvf /tmp/solver.tar.gz /var/log/zypper.solverTestCase'"); + script_run("scp $remote:/tmp/solver.tar.gz /tmp/solver.tar.gz"); + upload_logs('/tmp/solver.tar.gz', failok => 1); + } + croak("Zypper failed with $ret"); + } $cmd_time = time(); # second run, full system update - $ret = script_run("ssh $remote 'sudo zypper -n patch --with-interactive -l'", 6000); + $ret = script_run($cmd, 6000); record_info('zypper patch', 'The second command zypper patch took ' . (time() - $cmd_time) . ' seconds.'); - die "Zypper failed with $ret" if ($ret != 0 && $ret != 102); + if ($resolver_option) { + script_run("ssh $remote 'tar -czvf /tmp/solver.tar.gz /var/log/zypper.solverTestCase'"); + script_run("scp $remote:/tmp/solver.tar.gz /tmp/solver.tar.gz"); + upload_logs('/tmp/solver.tar.gz', failok => 1); + } + croak("Zypper failed with $ret") if ($ret != 0 && $ret != 102); } =head2 minimal_patch_system diff --git a/variables.md b/variables.md index ccab97bd7062..b92126cc4e02 100644 --- a/variables.md +++ b/variables.md @@ -384,6 +384,7 @@ PUBLIC_CLOUD_EMBARGOED_UPDATES_DETECTED | boolean | true | Internal variable wri PUBLIC_CLOUD_INFRA | boolean | false | Would trigger special flow in [check_registercloudguest.pm](tests/publiccloud/check_registercloudguest.pm) needed for run test against special test infra (DO NOT use the variable if you don't know what is about) PUBLIC_CLOUD_INFRA_RMT_V4 | string | "" | Defines IPv4 registration server in test infra. Must be used together with PUBLIC_CLOUD_INFRA. (DO NOT use the variable if you don't know what is about) PUBLIC_CLOUD_INFRA_RMT_V6 | string | "" | Defines IPv6 registration server in test infra. Must be used together with PUBLIC_CLOUD_INFRA. (DO NOT use the variable if you don't know what is about) +PUBLIC_CLOUD_GEN_RESOLVER | boolean | 0 | Control use of `--debug-resolver` option during maintenance updates testing . In case option was used also controls uploading of resolver case into the test ### Wicked testsuite specific variables