-
Notifications
You must be signed in to change notification settings - Fork 246
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
HSEARCH-3654 HSEARCH-4674 Upgrade to JUnit 5 + TestContainers #3320
HSEARCH-3654 HSEARCH-4674 Upgrade to JUnit 5 + TestContainers #3320
Conversation
e2a0334
to
7038dcd
Compare
Thanks for your pull request! This pull request appears to follow the contribution rules. › This message was automatically generated. |
3cf380d
to
4869857
Compare
…or tests with @before/@after
…ions as parameters
- pass only the callbacks that are needed rather than entire list
4869857
to
ea594e1
Compare
…nfiguring the session
ea594e1
to
f71396d
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Just a message to confirm I've seen that, but there's no way I can review it before the Christmas shutdown, so I'll probably only have a look next year :) |
@marko-bekhta please let me know when we can close this. I suppose we want to keep the testcontainers part around until we decide whether we want to go this way or with Dockerfiles instead (see https://hibernate.atlassian.net/browse/HSEARCH-4674?focusedCommentId=113129). But I'm not sure it's worth rebasing before we make that decision. |
we have a new draft now #3796 😃 🙈 so let's close this one |
https://hibernate.atlassian.net/browse/HSEARCH-3654
https://hibernate.atlassian.net/browse/HSEARCH-4674
Made a few tiny changes here 🥲
There are a few parts to this PR:
Assertions and assumptions
assertThat()
. As with Jupiter, the place for asserts changed and to keep things consistent, it's nice to have it all written in a similar manner.@Test
annotation - those got converted toassertThatThrownBy()
blocksRules converted to extensions
BeforeTestExecutionCallback, AfterTestExecutionCallback
soon after, I realized that we have tests here and there that can use extensions in the before/after methods. Hence going withBeforeEachCallback/AfterEachCallback
callbacks is a safer option@TempDir
orWireMock
are more or less straightforward changes.where
.strictness( Strictness.STRICT_STUBS )
part seems to be redundant as strict stubs are the default option in Mockito now. But nevertheless, just to keep things as they were, this got converted to@MockitoSettings(strictness = Strictness.STRICT_STUBS)
RetryRule
was an interesting case as it utilizes bothTestTemplateInvocationContextProvider
andTestExecutionExceptionHandler
, which probably none of the other our own extensions did.TestTemplateInvocationContextProvider
allows multiplying the execution of a test generating a stream of contexts.takari-cpsuite
dependency that was used to run TCK tests within IDE is removed and replaced with a simple main method and Jupiter launcher.@ClassRule
and@Rule
has aType
enum in them so that just one set of callbacks is executed. They also got a corresponding "***Global()static method to create what was previously a
@ClassRule`Everything else was more or less straightforward, where the rule
Statement
is now split into a pair ofBefore/After
callbacks and occasionally an exception handler.Runners
these aren't really extensions, but there wasn't much use of them in the tests:
@SpringTest
already has the correct extension registered@ExtendWith(SpringExtension.class)
@Nested
got replaced with Jupiter native annotationBytecodeEnhancerRunner
are currently disabled this is our own runner coming from ORM, and from what I see, it replaces the classloader, which, as I understood, isn't possible with Jupiter yet based on my research through Jupiter tickets.Parameterized tests
Even though these generated a lot of changes, there's not much to say about them. Parameterized tests in Jupiter are different from what they were in 4 🥲
Test containers integration
GenericContainer
,JdbcDatabaseContainer
) are used instead of ES/DB-specific ones. Looking at those dependencies, it seems that it is still expected to provide an exact version that we want to use.<TESTCONTAINERS_RYUK_DISABLED>true</TESTCONTAINERS_RYUK_DISABLED>
Ryuk container is disabled as it wasn't able to start on CI.System.setProperty()
. I've run into a few cases where properties could get cached or overridden by ORM 🥲