You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I understand it correctly, expectation is that if there are N tests in a test class, N+1 schemata will be created - one for each test and last one might remain unused.
But somehow I can't create an example where it is working as designed.
In test classes JdbiExtension members should be annotated as @RegisterExtension and it can be either Static Field or an Instance Field
When it is a static, 2 schemata are created, first is reused and provided to each test and second never comes in play.
When it is an instance, 2 schemata are created for each test, as a new extension instance is created for each test. First schema is used by the test and second is never used.
So, the tests either share the schema (in case of static extension) or always "wait" for a new schema (in case of instance field extension) .
I also configured some tests to run in parallel, with instance extension, but the result is the same - number of schemata created is 2 * number of tests. Parallel test with static extension are even dangerous - they run in the same schema and can interfere with each other.
The question is: is there an example, where the design from the above post works as explained?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
(when I say schema below, it can mean also user or database, depends of the database provider)
In this post @hgschmie gave a brief explanation of the idea to create schemata in a separate thread and this way minimize the wait time of the tests. This is implemented in TestcontainersDatabaseInformationSupplier.
If I understand it correctly, expectation is that if there are N tests in a test class, N+1 schemata will be created - one for each test and last one might remain unused.
But somehow I can't create an example where it is working as designed.
In test classes JdbiExtension members should be annotated as @RegisterExtension and it can be either Static Field or an Instance Field
When it is a static, 2 schemata are created, first is reused and provided to each test and second never comes in play.
When it is an instance, 2 schemata are created for each test, as a new extension instance is created for each test. First schema is used by the test and second is never used.
So, the tests either share the schema (in case of static extension) or always "wait" for a new schema (in case of instance field extension) .
I also configured some tests to run in parallel, with instance extension, but the result is the same - number of schemata created is 2 * number of tests. Parallel test with static extension are even dangerous - they run in the same schema and can interfere with each other.
The question is: is there an example, where the design from the above post works as explained?
Beta Was this translation helpful? Give feedback.
All reactions