From 37bc17efb5494e0909f3a0c07dc8e4a6ab7613a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Vidot?= Date: Wed, 13 Nov 2024 10:54:03 +0100 Subject: [PATCH] WIP Add snapper-zypp-plugin test https://progress.opensuse.org/issues/168079 --- tests/console/snapper_zypp.pm | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/console/snapper_zypp.pm diff --git a/tests/console/snapper_zypp.pm b/tests/console/snapper_zypp.pm new file mode 100644 index 000000000000..093090973b13 --- /dev/null +++ b/tests/console/snapper_zypp.pm @@ -0,0 +1,38 @@ +# SUSE's openQA tests +# +# Copyright SUSE LLC +# SPDX-License-Identifier: FSFAP +# Summary: Simple 'snapper-zypp-plugin' test +# 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; + run_zypper_cmd("in htop"); + run_zypper_cmd("rm htop"); + run_zypper_cmd("dup"); +} + +1; + +