Onboard package into gating

This commit is contained in:
Mikolaj Izdebski 2023-03-03 12:53:49 +01:00
parent 76fe61a6a9
commit bd65ea9dea
7 changed files with 81 additions and 0 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

8
gating.yaml Normal file
View File

@ -0,0 +1,8 @@
--- !Policy
product_versions:
- fedora-*
decision_contexts:
- bodhi_update_push_testing
- bodhi_update_push_stable
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

5
plans/plan.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Run smoke tests from dist-git
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: 0

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

@ -0,0 +1,3 @@
summary: Lujavrite smoke test
description: Test basic functionality of Lujavrite.
require: java-17-openjdk-headless

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

@ -0,0 +1,23 @@
#!/bin/bash
# Author: Mikolaj Izdebski <mizdebsk@redhat.com>
. /usr/share/beakerlib/beakerlib.sh
rlJournalStart
rlPhaseStartSetup
rlAssertRpm lujavrite
rlAssertRpm java-17-openjdk-headless
export JAVA_HOME=/usr/lib/jvm/jre-17-openjdk
rlPhaseEnd
rlPhaseStartTest
rlAssertExists "${JAVA_HOME}"
rlAssertExists "${JAVA_HOME}/lib/server/libjvm.so"
rlRun -s "lua smoke.lua"
rlAssertGrep "Java version is 17" $rlRun_LOG
rlAssertGrep "foo is bar" $rlRun_LOG
rlAssertGrep "nil in Lua is null in Java" $rlRun_LOG
rlPhaseEnd
rlJournalEnd
rlJournalPrintText

37
tests/smoke/smoke.lua Normal file
View File

@ -0,0 +1,37 @@
local lujavrite = require "lujavrite"
-- Determine Java home to use
java_home = os.getenv("JAVA_HOME")
if java_home == nil then
java_home = "/usr/lib/jvm/jre"
end
-- Initialize JVM
lujavrite.init(java_home .. "/lib/server/libjvm.so", "-ea", "-esa")
-- System.getProperty(key)
function get_property(key)
return lujavrite.call(
"java/lang/System", "getProperty",
"(Ljava/lang/String;)Ljava/lang/String;",
key
)
end
-- System.setProperty(key, value)
function set_property(key, value)
return lujavrite.call(
"java/lang/System", "setProperty",
"(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;",
key, value
)
end
local java_version = get_property("java.version")
print("Java version is " .. java_version)
set_property("foo", "bar")
print("foo is " .. get_property("foo"))
local java_nil = lujavrite.call("java/lang/String", "valueOf", "(Ljava/lang/Object;)Ljava/lang/String;", nil)
print("nil in Lua is " .. java_nil .. " in Java")