Add smoke tests, enable JPV tests

This commit is contained in:
Marian Koncek 2023-03-17 14:22:37 +01:00
parent e750d03c58
commit b4f10864b1
6 changed files with 87 additions and 0 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

1
ci.fmf Normal file
View File

@ -0,0 +1 @@
resultsdb-testcase: separate

9
gating.yaml Normal file
View File

@ -0,0 +1,9 @@
--- !Policy
product_versions:
- fedora-*
decision_contexts:
- bodhi_update_push_testing
- bodhi_update_push_stable
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/smoke.functional}
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/javapackages.functional}

45
plans/Smoke.java Normal file
View File

@ -0,0 +1,45 @@
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.Unmarshaller;
import java.io.InputStream;
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
@XmlRootElement(namespace = "org.fedoraproject.jaxb.test.smoke")
class Data
{
public String text = "default text";
public int number = 123;
}
public class Smoke
{
public static void main(String[] args) throws Exception
{
JAXBContext context = JAXBContext.newInstance(Data.class);
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
m.marshal(new Data(), baos);
Unmarshaller um = context.createUnmarshaller();
Data data;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
data = Data.class.cast(um.unmarshal(is));
}
if (!data.text.equals("default text"))
{
throw new RuntimeException("Expected \"default text\", found \"" + data.text + "\"");
}
if (data.number != 123)
{
throw new RuntimeException("Expected 123, found " + String.valueOf(data.number));
}
}
}

7
plans/javapackages.fmf Normal file
View File

@ -0,0 +1,7 @@
summary: Run javapackages-specific tests
discover:
how: fmf
url: https://src.fedoraproject.org/tests/javapackages
ref: f39
execute:
how: tmt

24
plans/smoke.fmf Normal file
View File

@ -0,0 +1,24 @@
summary: Basic smoke test
prepare:
- how: install
package:
- java-11-openjdk-devel
- xmvn-tools
- mvn(jakarta.activation:jakarta.activation-api)
- mvn(jakarta.xml.bind:jakarta.xml.bind-api)
- mvn(com.sun.istack:istack-commons-runtime)
discover:
how: shell
tests:
- name: /smoke/marshal-unmarshal
test: |
CLASSPATH+=":$(xmvn-resolve jakarta.activation:jakarta.activation-api)"
CLASSPATH+=":$(xmvn-resolve jakarta.xml.bind:jakarta.xml.bind-api)"
CLASSPATH+=":$(xmvn-resolve com.sun.istack:istack-commons-runtime)"
CLASSPATH+=":$(xmvn-resolve org.glassfish.jaxb:jaxb-runtime)"
CLASSPATH+=":$(xmvn-resolve org.glassfish.jaxb:jaxb-core)"
export CLASSPATH
/usr/lib/jvm/java-11-openjdk/bin/javac plans/Smoke.java
/usr/lib/jvm/java-11-openjdk/bin/java -cp "${CLASSPATH}:plans" Smoke
execute:
how: tmt