Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add snapper-zypp-plugin test #20618

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/main_common.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,7 @@ sub load_extra_tests_zypper {
replace_opensuse_repos_tests if is_repo_replacement_required;
loadtest "console/zypper_lr_validate" unless is_sle '15+';
loadtest "console/zypper_ref";
loadtest "console/snapper_zypp";
unless (is_jeos) {
loadtest "console/zypper_info";
}
Expand Down
1 change: 1 addition & 0 deletions schedule/functional/extra_tests_textmode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ schedule:
- console/zypper_lr_validate
- console/zypper_ref
- console/zypper_info
- console/snapper_zypp
- '{{validate_packages_and_patterns}}'
- console/zypper_extend
- console/check_os_release
Expand Down
44 changes: 44 additions & 0 deletions tests/console/snapper_zypp.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# SUSE's openQA tests
#
# Copyright SUSE LLC
# SPDX-License-Identifier: FSFAP
# Summary: Simple 'snapper-zypp-plugin' test
# 1. Ensure 'snapper-zypp-plugin' is installed
# 2. Get latest snapshot id number
# 3. Install/remove package
# 4. Ensure id number incremented by 2 (pre/post snapshots were created)
# Maintainer: QE Core <[email protected]>

use base "consoletest";
use strict;
use warnings;
use testapi;
use serial_terminal 'select_serial_terminal';
use utils;
use version_utils 'is_sle';
use Test::Assert 'assert_equals';

sub get_snapshot_id {
my $snapshot_id = is_sle("<=12-SP5") ? '$3' : '$1';
return script_output("snapper ls | awk 'END {print $snapshot_id}'");
}

sub run_zypper_cmd {
my $zypper_cmd = shift;
my $before_snapshot_id = get_snapshot_id();
zypper_call($zypper_cmd);
my $after_snapshot_id = get_snapshot_id();
record_info("Snapshot IDs", "Before: $before_snapshot_id, After: $after_snapshot_id");
assert_equals($after_snapshot_id, $before_snapshot_id + 2, "Snapshot ID did not increment as expected");
}

sub run {
select_serial_terminal;
my $package = "atftp";

assert_script_run("rpm -q snapper-zypp-plugin");
run_zypper_cmd("in $package");
run_zypper_cmd("rm $package");
}

1;
Loading