diff --git a/lib/main_common.pm b/lib/main_common.pm index db15d4e2239e..a73f60163086 100644 --- a/lib/main_common.pm +++ b/lib/main_common.pm @@ -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"; } diff --git a/schedule/functional/extra_tests_textmode.yaml b/schedule/functional/extra_tests_textmode.yaml index 7b322d9c745e..a41105783372 100644 --- a/schedule/functional/extra_tests_textmode.yaml +++ b/schedule/functional/extra_tests_textmode.yaml @@ -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 diff --git a/tests/console/snapper_zypp.pm b/tests/console/snapper_zypp.pm new file mode 100644 index 000000000000..a00742b50cfd --- /dev/null +++ b/tests/console/snapper_zypp.pm @@ -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 + +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;