Closed zakkak closed 3 years ago
/cc @cescoffier
Snappy requires graalvm 21.+ because of serialization and method handle support.
Thanks @cescoffier.
In that case we need a way to detect that the test/app is relying on some unsupported feature and report it to the user. Then the test suite should ideally be able to either skip unsupported tests (based on the GraalVM/Mandrel version) or parse their output and mark them as passing if they fail with the expected message.
that feature waited for Quarkus to switch to GraalVM 21+ as default and prevent using older versions. How did you end up having the issue?
But yes, I agree that we should warn the user in the log, not only on the documentation.
How did you end up having the issue?
I am using this workflow https://github.com/zakkak/graalvm-quarkus-ci/blob/main/.github/workflows/quarkus.yml to test Quarkus main (and other versions) with various GraalVM versions, so running the workflow with 20.3 picked the test from main
's .github/native-tests.json
.
ah ah.... yeah.... if you remove the safeguard, then :-D
So there are multiple tasks:
In JUnit you can have arbitrary predicates.
We could likely just check the GraalVM version and decide whether or not the test should be skipped
Yes, and we have that code somewhere already (in the devtools)
I gave @DisabledIf
a go with no luck.
diff --git a/integration-tests/kafka-snappy/src/test/java/io/quarkus/it/kafka/KafkaSnappyProducerTest.java b/integration-tests/kafka-snappy/src/test/java/io/quarkus/it/kafka/KafkaSnappyProducerTest.java
index b39aac6892..7330285d7e 100644
--- a/integration-tests/kafka-snappy/src/test/java/io/quarkus/it/kafka/KafkaSnappyProducerTest.java
+++ b/integration-tests/kafka-snappy/src/test/java/io/quarkus/it/kafka/KafkaSnappyProducerTest.java
@@ -13,10 +13,12 @@ import org.apache.kafka.common.serialization.IntegerDeserializer;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledIf;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
+@DisabledIf(value = "graalVM20OrEarlier", disabledReason = "Kafka Snappy not working in GraalVM < 21.0")
@QuarkusTest
public class KafkaSnappyProducerTest {
@@ -33,6 +35,10 @@ public class KafkaSnappyProducerTest {
return consumer;
}
+ public static boolean graalVM20OrEarlier() {
+ return org.graalvm.home.Version.getCurrent().compareTo(21) < 0;
+ }
+
@Test
public void test() throws Exception {
KafkaConsumer<Integer, String> consumer = createConsumer();
The problem seems to be that the JUnit tests are being run using the hosts JVM which results in org.graalvm.home.Version.getCurrent()
returning "snapshot". If I change the JAVA_HOME
to point to GraalVM then it works.
So we need to:
native-image
using: https://github.com/quarkusio/quarkus/blob/ed353c7e392d7457671447cb49db5f25ad698062/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildRunner.java#L24 However, to do this we need all the native-image-related properties passed to package
to be propagated to the JVM running the JUnit tests.I'll take a look next week and see what can be done
https://github.com/quarkusio/quarkus/pull/16236 takes care of it
Describe the bug
Native image of integration test
kafka-snappy
fails with GraalVM 20.3.1.2Expected behavior
The native image test should pass.
Actual behavior
The native image test fails with:
To Reproduce
Environment (please complete the following information):
Output of
uname -a
orver
Linux 5.10.20-200.fc33.x86_64
Output of
java -version
11.0.10+9
GraalVM version (if different from Java)
20.3.1.2
Quarkus version or git rev
main
: 06e7f6248786c3c8868c818b55d4792c441f3e8fBuild tool (ie. output of
mvnw --version
orgradlew --version
)Maven 3.6.3