Files
graylog2-server/data-node
Kay Roepke 606f80d52a Migrate from JUnit 4 to 6 (#24012)
* add openrewrite infrastructure and necessary junit jupiter api deps

* update openrewrite docs and remove configLocation from plugin config, so we can override it

* initial openrewrite migration to junit5, work in progress

* replace rule with extension, use mongocollections instead of the instance

* fix parameterized test

* replace jukito with guice-extension for junit5 compatibility

* yet more mongocollections injection

* manually create MongoCollections where we need a custom objectmapper for subtypes

* fix license header

* replace junit4 conditional runner with enabledif static methods, only used in a single test anyway

* fix resource name collision in class loader test

* how did this ever compile?

* use explicit temp dir in tests, otherwise we'd need to create the directories

* add extension that tracks search instances and properly calls their clean up methods according to test lifecycle

* add comment explaining how the closing of testable search instances works with the extension

* use convert rule to extension

* convert rule to extension

* remove old import

* convert SkipDefaultIndexTemplateWatcher to junit5 extension api

* migrate from @Rule to @SearchInstance

* convert remaining @Rule to @SearchInstance

* clean up imports

* replace legacy RestoreSystemProperties rules with custom extension

* migrate all remaining junit4 references

* replace legacy system-rules dep with more modern one for system stream capturing

* remove unused junit4 import

* remove junit5-system-extensions, causes junit engine crashes

* remove legacy junit4 dependency for good :party:

* remove unnecessary openrewrite doc

* move forbiddenapi back out of profile, to avoid it being disabled when other profiles are explicitly given

* suppress forbidden api check for search instance detection

* remove jukito + vintage engine and adapt usage of legacy junit4 apis

* add core junit4 classes Test and Assert to forbidden apis

* replace forbidden junit4 api with junit6 equivalent

* remove guava testlib as it pulls in junit4, replaced FakeTicker with a simpler custom implementation for tests

* update testcontainers to 2.0.2 to get rid of the junit4 transitive dependency

needed to remove all ExternalResources
 * migrated MongoDBInstance to MongoDBTestService (basically identically anyway)
 * inlined some unnecessary interfaces

removed unused imports of junit4 classes

* migrate junit4 api usage

mockito with junit5 is much stricter about argument matcher types, so we need to adapt to Set -> Collection signature change

* actually start the container now that MongoDBInstance.java is gone

* improve test code

* simplify test case

* simplify test case

* simplify test case

* simplify test case

* simplify test case

* simplify test case

* forgot to remove the commented junit4 superclass

* rename MongoDBTestService#create methods to #createStarted and make start() private

* don't close the per-class mongodb instance for @Nested junit test classes

otherwise the first afterAll callback will destroy the instance and subsequent tests will fail
2025-11-20 15:09:03 +01:00
..
2025-11-20 15:09:03 +01:00
2023-02-27 13:11:24 +01:00

First version, additional info to follow.