Skip to content

Commit

Permalink
Check SMELT to decide when SLES+HA tests can be skipped on QAM
Browse files Browse the repository at this point in the history
The `lib/hacluster::is_not_maintenance` function was originally created
to skip resource-expensive test modules when the package under test in
Maintenance is not related to these tests (for example, `samba` or
`ctdb` for `ha/ctdb` and `ha/filesystem`, `haproxy` for `ha/haproxy` or
`drbd` for `ha/drbd_passive` and `ha/filesystem`). The function would
decide this only based on the *BUILD* setting, which was supposed to
contain the package under test, but in reality a Maintenance Update can
include multiple packages and the one which is used in the *BUILD*
setting is actually only the first package from the MU when ordered
alphabetically. This of course causes some tests to be skipped even when
it is necessary that they run.

This commit modifies the `lib/hacluster::is_not_maintenance` function to
also query SMELT for the list of packages associated to the Maintenance
Incident, and then check against that list too after having checked
against the value of the *BUILD* setting. This way, the function is more
exhaustive in its checks, and should not skip necessary tests based on
incomplete information. It also adds a check for `kernel`, as kernel
maintenances should not skip any tests.
  • Loading branch information
alvarocarvajald committed Aug 15, 2024
1 parent 7470809 commit de24f37
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lib/hacluster.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use utils;
use testapi;
use lockapi;
use isotovideo;
use maintenance_smelt qw(get_incident_packages);
use x11utils qw(ensure_unlocked_desktop);
use Utils::Logging qw(export_logs);
use Carp qw(croak);
Expand Down Expand Up @@ -1007,16 +1008,25 @@ sub test_flags {
is_not_maintenance_update( $package );
Checks if the package specified in B<$package> is not targeted by a maintenance
update. Returns true if the package is not targeted, i.e., package name does not
appear in the B<BUILD> setting and the B<MAINTENANCE> setting is active, or false
in all other cases.
update. Returns true if the package is not targeted, i.e., B<MAINTENANCE> setting
is active and package name does not appear in the B<BUILD> setting nor is it
in the list of packages in the related B<INCIDENT_ID>. Returns false in all other
cases. Besides the package B<$package>, it also checks for B<kernel> in the B<BUILD>
setting and the list of packages, as the tests should always run with updates to the
kernel.
=cut

sub is_not_maintenance_update {
my $package = shift;
# Allow to skip an openQA module if package is not targeted by maintenance update
if (get_var('MAINTENANCE') && get_var('BUILD') !~ /$package/) {
if (get_var('MAINTENANCE')) {
# If package is listed in BUILD, no need to check for more
return 0 if (get_var('BUILD') =~ /$package|kernel/);
# Package name is not in BUILD setting, but it can still be targeted by the
# incident, so let's query SMELT to confirm
my @incident_packages = get_incident_packages(get_required_var('INCIDENT_ID'));
return 0 if (grep(/$package|kernel/, @incident_packages));
record_info('Skipped - MU', "$package test not needed here");
return 1;
}
Expand Down

0 comments on commit de24f37

Please sign in to comment.