Skip to content
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

Housekeeping: make Postgres tests also run the H2-based tests #1754

Closed
2 tasks done
paullatzelsperger opened this issue Jul 28, 2022 · 0 comments · Fixed by #1841
Closed
2 tasks done

Housekeeping: make Postgres tests also run the H2-based tests #1754

paullatzelsperger opened this issue Jul 28, 2022 · 0 comments · Fixed by #1841
Assignees
Labels
enhancement New feature or request refactoring Cleaning up code and dependencies
Milestone

Comments

@paullatzelsperger
Copy link
Member

paullatzelsperger commented Jul 28, 2022

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:

  1. Move the actual test code into a "test method" class, and invoke all methods from the test classes:
    @Test
    void someTest(){
        testMethods.runSomeTest();
    }
    The upside is that test code is centrally located. The downside is that we still have to duplicate all test methods.
  2. 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!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactoring Cleaning up code and dependencies
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant