Skip to content

Commit

Permalink
Enable validation for dud_development_tools
Browse files Browse the repository at this point in the history
The commit adds the appropriate test module and updates schedule file to
make the validation that DUD addon repos are enabled.

Related ticket: https://progress.opensuse.org/issues/69043
  • Loading branch information
Oleksandr Orlov committed Aug 3, 2020
1 parent 30d29a9 commit 9fe2c3e
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
26 changes: 25 additions & 1 deletion lib/repo_tools.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ our @EXPORT = qw(
prepare_oss_repo
disable_oss_repo
generate_version
validate_repo_enablement);
validate_repo_enablement
parse_repo_data
);

=head2 add_qa_head_repo
Expand Down Expand Up @@ -408,4 +410,26 @@ sub validate_repo_enablement {
"Repository $args{name} has system wrong url or repo is not added to the system:\n$output");
}

=head2 parse_repo_data
parse_repo_data($repo_identifier);
Parses the output of 'zypper lr C<$repo_identifier>' command (detailed information about specific repository) and
returns it as Hash reference.
C<$repo_identifier> can be either alias, name, number from simple zypper lr, or URI.
Please, search for 'repos (lr)' on 'https://en.opensuse.org/SDB:Zypper_manual' page for more details of the command
usage and its output.
Returns Hash reference with all the parsed properties and their values, for example:
{Alias => 'repo-oss', Name => 'openSUSE-Tumbleweed-Oss', Enabled => 'Yes', ...}
=cut
sub parse_repo_data {
my ($repo_identifier) = @_;
my @lines = split(/\n/, script_output("zypper lr $repo_identifier"));
my %repo_data = map { split(/\s*:\s*/, $_, 2) } @lines;
return \%repo_data;
}

1;
8 changes: 8 additions & 0 deletions schedule/yast/dud_development_tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ schedule:
- installation/reboot_after_installation
- installation/grub_test
- installation/first_boot
- console/validate_dud_addon_repos
- console/orphaned_packages_check
test_data:
dud_repos:
# The URI is the same as set in 'data/dev_tools.dud' file.
- URI: 'ftp://openqa.suse.de/SLE-15-Module-Development-Tools-POOL-x86_64-Media1-CURRENT'
Enabled: Yes
Autorefresh: On
38 changes: 38 additions & 0 deletions tests/console/validate_dud_addon_repos.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SUSE's openQA tests
#
# Copyright © 2020 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: Validate that DUD addon repos activated during the installation are
# properly added and enabled. Also, verifies that 'zypper ref' works and all the
# repositories can be refreshed.
#
# Maintainer: QA SLE YaST team <qa-sle-yast@suse.de>

use base 'consoletest';
use strict;
use warnings;

use testapi;
use repo_tools 'parse_repo_data';
use scheduler 'get_test_suite_data';
use Test::Assert ':all';

sub run {
my $test_data = get_test_suite_data();
select_console 'root-console';
foreach my $expected_dud_repo (@{$test_data->{dud_repos}}) {
my $actual_dud_repo = parse_repo_data($expected_dud_repo->{URI});
assert_equals($expected_dud_repo->{Enabled}, $actual_dud_repo->{Enabled},
"Fail! It is expected that the 'Enabled' field is set to $expected_dud_repo->{Enabled}, but it is $actual_dud_repo->{Enabled}");
assert_equals($expected_dud_repo->{Autorefresh}, $actual_dud_repo->{Autorefresh},
"Fail! It is expected that the 'Autorefresh' field is set to $expected_dud_repo->{Autorefresh}, but it is $actual_dud_repo->{Autorefresh}");
}
assert_script_run('zypper -v ref | grep "All repositories have been refreshed"', 120);
}

1;

0 comments on commit 9fe2c3e

Please sign in to comment.