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
For many SQL-implementations we have two test classes: one that uses H2, and one that uses an actual Postgres instance. This was done to enable the SQL test to run locally and very fast without an actual Postgres instance.
Due to to fact how JUnit Test tags work, the Postgres test cannot extend the H2 test, because then it would always run, even if the -DincludeTags="PostgresqlDbIntegrationTest" is not specified, thus requiring all developers to have a local Postgres instance.
We have observed on multiple occasions that bugs occur on Postgres, and not on H2, especially when using Postgres-specific features, such as the JSON datatype.
Which Areas Would Be Affected?
build, CI
Why Is the Feature Desired?
Test coverage, test consistency
Solution Proposal
There are basically two ways I can think of to solve this:
Move the actual test code into a "test method" class, and invoke all methods from the test classes:
@TestvoidsomeTest(){
testMethods.runSomeTest();
}
The upside is that test code is centrally located. The downside is that we still have to duplicate all test methods.
ditch H2, run everything on Postgres. The upside of this is that we always have realistic tests, don't need to run them twice. The downside is, that for locally running the test, users have to run Postgres and specify the -DincludeTags="PostgresqlDbIntegrationTest" flag
As a semi-related issue we could move all the Postgres initialization code into a JUnit PostgresExtension and add an @ExtendWith on the test class.
Type of Issue
cleanup
Checklist
assigned appropriate label?
Do NOT select a milestone or an assignee!
The text was updated successfully, but these errors were encountered:
Feature Request
For many SQL-implementations we have two test classes: one that uses H2, and one that uses an actual Postgres instance. This was done to enable the SQL test to run locally and very fast without an actual Postgres instance.
Due to to fact how JUnit Test tags work, the Postgres test cannot extend the H2 test, because then it would always run, even if the
-DincludeTags="PostgresqlDbIntegrationTest"
is not specified, thus requiring all developers to have a local Postgres instance.We have observed on multiple occasions that bugs occur on Postgres, and not on H2, especially when using Postgres-specific features, such as the
JSON
datatype.Which Areas Would Be Affected?
build, CI
Why Is the Feature Desired?
Test coverage, test consistency
Solution Proposal
There are basically two ways I can think of to solve this:
-DincludeTags="PostgresqlDbIntegrationTest"
flagAs a semi-related issue we could move all the Postgres initialization code into a JUnit
PostgresExtension
and add an@ExtendWith
on the test class.Type of Issue
cleanup
Checklist
The text was updated successfully, but these errors were encountered: