Add smoke test

This commit is contained in:
Mikolaj Izdebski 2023-03-07 00:53:33 +01:00
parent 666261c66e
commit 5da7181fa4
6 changed files with 75 additions and 0 deletions

View File

@ -5,4 +5,5 @@ decision_contexts:
- bodhi_update_push_testing - bodhi_update_push_testing
- bodhi_update_push_stable - bodhi_update_push_stable
rules: rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/smoke.functional}
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/javapackages.functional} - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/javapackages.functional}

5
plans/smoke.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Run smoke tests
discover:
how: fmf
execute:
how: tmt

4
tests/main.fmf Normal file
View File

@ -0,0 +1,4 @@
contact: Mikolaj Izdebski <mizdebsk@redhat.com>
framework: beakerlib
test: ./runtest.sh
tier: 1

7
tests/smoke/main.fmf Normal file
View File

@ -0,0 +1,7 @@
summary: XMvn Generator smoke test
description: |
Test basic functionality of XMvn Generator.
require:
- rpm-build
- javapackages-local
- java-17-openjdk-devel

34
tests/smoke/runtest.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
# Author: Mikolaj Izdebski <mizdebsk@redhat.com>
. /usr/share/beakerlib/beakerlib.sh
rlJournalStart
rlPhaseStartSetup
rlAssertRpm xmvn-generator
rlAssertRpm javapackages-local
rlAssertRpm rpm-build
rlAssertRpm java-17-openjdk-devel
rlPhaseEnd
rlPhaseStartTest
rlRun -s "rpmbuild -D '%_topdir %{lua:print(posix.getcwd())}' -D '%_sourcedir %{_topdir}' -D '%_builddir %{_topdir}/build' -D '%_srcrpmdir %{_topdir}' -D '%_rpmdir %{_topdir}' -D '__xmvngen_debug 1' -ba testpkg.spec"
rlAssertGrep "^INSTALL DONE$" $rlRun_LOG
rpm=noarch/testpkg-1.2.3-1.fc22.noarch.rpm
rlAssertExists $rpm
rlRun -s "rpm -qp $rpm --provides"
rlAssertGrep "^jpms(foo.module)$" $rlRun_LOG
rlRun "rpm2cpio $rpm | cpio -id"
rlAssertExists usr/share/java/sub/some.jar
rlRun "jar xf usr/share/java/sub/some.jar"
rlAssertExists file.txt
rlAssertExists META-INF/MANIFEST.MF
rlAssertGrep "^Automatic-Module-Name: foo.module" META-INF/MANIFEST.MF
rlAssertGrep "^Rpm-Name: testpkg" META-INF/MANIFEST.MF
rlAssertGrep "^Rpm-Epoch: 42" META-INF/MANIFEST.MF
rlAssertGrep "^Rpm-Version: 1.2.3" META-INF/MANIFEST.MF
rlAssertGrep "^Rpm-Release: 1.fc22" META-INF/MANIFEST.MF
rlPhaseEnd
rlJournalEnd
rlJournalPrintText

24
tests/smoke/testpkg.spec Normal file
View File

@ -0,0 +1,24 @@
Name: testpkg
Epoch: 42
Version: 1.2.3
Release: 1.fc22
Summary: test package
License: DUMMY
URL: file:/dev/null
BuildArch: noarch
%description
test package
%install
touch file.txt
echo Automatic-Module-Name: foo.module >mf
echo Rpm-Version: 4.5.6 >>mf
jar cfm out.jar mf file.txt
install -D out.jar %{buildroot}%{_javadir}/sub/some.jar
echo INSTALL DONE
%files
%{_javadir}
%changelog