chore: Add add tmt tests and plans and add them to sync

Signed-off-by: Tibor Dudlák <tdudlak@redhat.com>
This commit is contained in:
Tibor Dudlák 2022-12-15 08:07:30 +01:00
commit 13ae0ebc4d
No known key found for this signature in database
GPG key ID: 12B8BD343576CDF5
5 changed files with 92 additions and 1 deletions

View file

@ -10,6 +10,10 @@ files_to_sync:
- .packit.yaml
- gating.yaml
- ci.fmf
- src: ./tests/smoke/*
dest: ./tests/smoke/
- src: ./plans/*
dest: ./plans/
# Allow disgit reactions on packit and tdudlak commits and PRs
allowed_pr_authors:

View file

@ -1,6 +1,6 @@
Name: mrack
Version: 1.12.3
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Multicloud use-case based multihost async provisioner
License: Apache-2.0
@ -177,6 +177,9 @@ rm -r src/%{name}.egg-info
%{python3_sitelib}/%{name}/providers/utils/{,__pycache__/}testcloud.*
%changelog
* Tue Dec 13 2022 Tibor Dudlák <tdudlak@redhat.com> - 1.12.3-4
- chore: Add add tmt tests and plans and add them to sync (Tibor Dudlák)
* Tue Dec 13 2022 Tibor Dudlák <tdudlak@redhat.com> - 1.12.3-3
- chore: Add fmf/version and allowed users to run packit (Tibor Dudlák)

9
plans/tests.fmf Normal file
View file

@ -0,0 +1,9 @@
summary: Smoke test for mrack
discover:
how: fmf
prepare:
- how: shell
script:
- dnf remove -y `rpm -qa | grep mrack`
execute:
how: tmt

8
tests/smoke/main.fmf Normal file
View file

@ -0,0 +1,8 @@
summary: Run Smoke tests
test: ./smoke-test.sh
enabled: true
path: /tests/smoke
require:
- which
framework: beakerlib
duration: 10m

67
tests/smoke/smoke-test.sh Executable file
View file

@ -0,0 +1,67 @@
#!/bin/bash
# Author: Tibor Dudlák
. /usr/share/beakerlib/beakerlib.sh || ( echo "FAILED to source beakerlib" && exit 1 )
install_package () {
rlPhaseStartSetup "Installing $1"
rlRun "dnf install -y $1"
rlPhaseEnd
}
print_and_remove_mrack_log(){
rlPhaseStartTest "Print and remove mrack.log"
rlRun "cat mrack.log && rm -f mrack.log"
rlPhaseEnd
}
rm_mracklog_run_mrack_up () {
rlPhaseStartTest "Remove mrack.log and run mrack up"
rlRun "rm -f mrack.log"
rlRun "mrack up 2>&1 | grep 'Installed providers:'"
rlPhaseEnd
}
rlJournalStart
rlPhaseStartSetup "Check required packages and absence of mrack"
rlAssertRpm "which"
rlRun "dnf remove -y `rpm -qa | grep mrack` || true"
rlPhaseEnd
rlPhaseStartTest "mrack should not be pre-installed on system"
rlRun "python3 -c \"import mrack\"" 1
rlPhaseEnd
install_package "python3-mracklib"
rlPhaseStartTest "mrack command NOT present on system"
rlRun "which mrack 2>&1 | grep -i 'no' | grep 'mrack'"
rlPhaseEnd
install_package "mrack-cli"
rlPhaseStartTest "mrack command present on system"
rlRun "which mrack | grep 'bin/mrack'"
rlRun "mrack --version"
rlPhaseEnd
install_package "python3-mrack-beaker"
rm_mracklog_run_mrack_up
install_package "mrack"
rm_mracklog_run_mrack_up
print_and_remove_mrack_log
rlPhaseStartSetup "Reinstall mrack"
rlRun "dnf reinstall mrack -y"
rlPhaseEnd
rm_mracklog_run_mrack_up
print_and_remove_mrack_log
rlJournalEnd