Skip to content

Respect @DBRider in junit5 @BeforeAll, @BeforeEach, @AfterAll, @AfterEach methods#601

Merged
rmpestano merged 2 commits intodatabase-rider:masterfrom
vaa25:dbrider-respect-in-callback-methods
Jul 25, 2024
Merged

Respect @DBRider in junit5 @BeforeAll, @BeforeEach, @AfterAll, @AfterEach methods#601
rmpestano merged 2 commits intodatabase-rider:masterfrom
vaa25:dbrider-respect-in-callback-methods

Conversation

@vaa25
Copy link
Copy Markdown
Contributor

@vaa25 vaa25 commented Jul 21, 2024

Current implementation doesn't support @dbrider in callback methods. It makes impossible to set up test data into several independent datasources. This pr makes working such approach:

    @BeforeAll
    @DBRider(dataSourceBeanName = "firstDataSource")
    @DataSet(value = "test-data-1.xml")
    static void setUpDataInFirstDb() {
    }

    @BeforeAll
    @DBRider(dataSourceBeanName = "secondDataSource")
    @DataSet(value = "test-data-2.xml", disableConstraints = true)
    static void setUpDataInSecondDb() {
    }

@vaa25 vaa25 force-pushed the dbrider-respect-in-callback-methods branch from d2f7f6a to 6432703 Compare July 21, 2024 13:49
Copy link
Copy Markdown
Member

@rmpestano rmpestano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the contribution!

@rmpestano rmpestano added this to the 1.43.0 milestone Jul 21, 2024
@rmpestano
Copy link
Copy Markdown
Member

Also, can you check the failing test case?

Error: LeakingConnectionsTest.shouldListUsers:91 » CannotGetJdbcConnection Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 5001ms.

@rmpestano rmpestano modified the milestones: 1.43.0, 1.44.0 Jul 21, 2024
@vaa25 vaa25 force-pushed the dbrider-respect-in-callback-methods branch from 6432703 to 2448454 Compare July 23, 2024 08:34
@vaa25 vaa25 force-pushed the dbrider-respect-in-callback-methods branch from 2448454 to a3ce592 Compare July 23, 2024 08:35
@vaa25
Copy link
Copy Markdown
Contributor Author

vaa25 commented Jul 23, 2024

I have checked that test, but I doubt it works properly. WrappingDataSource.liveConnections is never changed and assert on it has no sense.

@vaa25 vaa25 requested a review from rmpestano July 23, 2024 09:20
@rmpestano rmpestano merged commit 59eab5a into database-rider:master Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants