-
Notifications
You must be signed in to change notification settings - Fork 653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration tests for JenaSystem#init #2809
Comments
Would configuring all of the integration tests to run in their own JVM process in the POM solve the issue of a clean JVM? It could slow down the builds if configured in the integration test pom (https://github.com/apache/jena/blob/main/jena-integration-tests/pom.xml#L199), according to the docs
I don't know if it is possible, but setting up a second surefire test execution, using multiple executor's with a different naming-pattern to catch integration tests that need a fresh JVM, could also be an option, if the integration tests increase a lot in time spent, if updating all tests is a no-go. |
@OyvindLGjesdal Thank you for suggesting multiple Surefire test executions - it might be a great idea. However, there are a couple of minor issues with this approach:
I will give it a try. At the moment, I prefer the JMH variant because it is straightforward and doesn't present the issues mentioned above. |
Version
5.3.0-SNAPSHOT
Feature
Implementing a JUnit integration test for
JenaSystem#init
is straightforward, but it must be run as a single-method test to ensure a fresh JVM. Only then can we effectively debug and test the execution of static initializers.A regression test for apache/jena#2675 would look like this:
For apache/jena#2787, the regression test is as follows:
When running multiple tests within a suite or a single file, static initializers may be triggered unpredictably, as any test could initialize them, and they cannot be re-triggered within the same JVM instance (or class loader). I attempted various JUnit annotations and methods to make these tests work within a Maven build, but found no JUnit-based solution. However, I found a workaround using the JMH benchmark framework, which runs each benchmark in a freshly started JVM.
JMH uses code generation, which needs to be triggered whenever the benchmark code is changed. For JetBrains IDEA, there's a plugin that automates code generation in the background. Unfortunately, for other IDEs like Eclipse, this process has to be triggered manually by running
mvn clean install
.I would like to submit a PR to extend the integration tests. However, I’d like to confirm whether introducing JMH into the
jena-integration-tests
is accepted by the Jena developer community before proceeding further.Are you interested in contributing a solution yourself?
Yes
The text was updated successfully, but these errors were encountered: