From 477d918b64caf7d9832f280897b1b88da8ef0974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20R=C5=AF=C5=BEi=C4=8Dka?= Date: Mon, 15 Mar 2021 18:40:42 +0100 Subject: [PATCH] Add testcase to test the Package_install_remove testcase. --- templates.fif.json | 25 ++++++++++++ tests/base_package_install_remove.pm | 57 ++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 tests/base_package_install_remove.pm diff --git a/templates.fif.json b/templates.fif.json index a7f56c50..2aa5afe6 100644 --- a/templates.fif.json +++ b/templates.fif.json @@ -603,6 +603,31 @@ "USER_LOGIN": "false" } }, + "base_package_install_remove": { + "profiles": { + "fedora-Cloud_Base-qcow2-qcow2-aarch64-*-aarch64": 40, + "fedora-Cloud_Base-qcow2-qcow2-ppc64le-*-ppc64le": 40, + "fedora-Cloud_Base-qcow2-qcow2-x86_64-*-64bit": 40, + "fedora-KDE-live-iso-x86_64-*-64bit": 42, + "fedora-Minimal-raw_xz-raw.xz-arm-*-ARM": 42, + "fedora-Minimal-raw_xz-raw.xz-aarch64-*-aarch64": 42, + "fedora-Server-dvd-iso-aarch64-*-aarch64": 40, + "fedora-Server-dvd-iso-ppc64le-*-ppc64le": 40, + "fedora-Server-dvd-iso-x86_64-*-64bit": 40, + "fedora-Server-raw_xz-raw.xz-aarch64-*-aarch64": 42, + "fedora-Workstation-live-iso-ppc64le-*-ppc64le": 40, + "fedora-Workstation-live-iso-x86_64-*-64bit": 40, + "fedora-Workstation-raw_xz-raw.xz-aarch64-*-aarch64": 42 + }, + "settings": { + "BOOTFROM": "c", + "HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2", + "POSTINSTALL": "base_package_install_remove", + "ROOT_PASSWORD": "weakpassword", + "START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%", + "USER_LOGIN": "false" + } + }, "base_services_start": { "profiles": { "fedora-Cloud_Base-qcow2-qcow2-aarch64-*-aarch64": 40, diff --git a/tests/base_package_install_remove.pm b/tests/base_package_install_remove.pm new file mode 100644 index 00000000..9b069d5f --- /dev/null +++ b/tests/base_package_install_remove.pm @@ -0,0 +1,57 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +sub run { + my $self = shift; + # switch to TTY3 for both, graphical and console tests + $self->root_console(tty=>3); + + # This test case tests that packages can be correctly installed and removed. + # We will test by installing two packages - ftp and mc. + # + # Install the FTP package. + assert_script_run("dnf install -y ftp", timeout => 240); + # Check the main packages are installed. + # Confirm that dnf lists the package + assert_script_run("dnf list ftp"); + # Confirm that RPM lists the packages + assert_script_run("rpm -q ftp"); + # Verify the installations using rpm --verify + assert_script_run("rpm --verify ftp"); + + # Install the MC package. + assert_script_run("dnf install -y mc", timeout => 240); + # Check the main packages are installed. + # Confirm that dnf lists the package + assert_script_run("dnf list mc"); + # Confirm that RPM lists the packages + assert_script_run("rpm -q mc"); + # Verify the installations using rpm --verify + assert_script_run("rpm --verify mc"); + + # Now we will uninstall the packages again and we will check that they have been uninstalled. + # We will not check that all of the dependencies have been uninstalled, too, because the + # dependencies might have been on the system already to satisfy some other packages' needs, + # which we believe is the normal user approach. + # + # Uninstall the packages. + assert_script_run("dnf remove -y ftp mc"); + # Reports by the DNF + assert_script_run("!dnf list ftp"); + assert_script_run("!dnf list mc"); + # Reports by the RPM + assert_script_run("!rpm -q ftp"); + assert_script_run("!rpm -q mc"); + +} + + +sub test_flags { + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: