Skip to content

Commit

Permalink
Add snapper-zypp-plugin test
Browse files Browse the repository at this point in the history
  • Loading branch information
cedvid committed Jan 7, 2025
1 parent 77ab2fd commit 27b40e5
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
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
42 changes: 42 additions & 0 deletions tests/console/snapper_zypp.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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 <qe-core@suse.de>

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

sub get_snapshot_id {
return script_output("snapper ls | awk 'END {print \$1}'");
}

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 = "htop";

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

1;

0 comments on commit 27b40e5

Please sign in to comment.