Skip to content

test: EXPOSED-233 Add additional SpringTransactionManager isolation test#1972

Merged
e5l merged 4 commits intoJetBrains:mainfrom
FullOfOrange:fulloforange/add-single-datasource-isolation-test
Jan 23, 2024
Merged

test: EXPOSED-233 Add additional SpringTransactionManager isolation test#1972
e5l merged 4 commits intoJetBrains:mainfrom
FullOfOrange:fulloforange/add-single-datasource-isolation-test

Conversation

@FullOfOrange
Copy link
Contributor

@FullOfOrange FullOfOrange commented Jan 21, 2024

Sorry for the late PR!
Added some tests to test the isolation level of SpringTransactionManager.

  1. Write test code in SpringTransactionSingleConnectionTest to check if the issue that when there is only one connection, the connection cannot be obtained unless the default isolation level is set is fixed in the latest version.

  2. Add test code to check if the isolation level is set well in the existing test

Discussion

  1. I have confirmed that the problem encountered in this issue is resolved in the current version. I wonder if additional isolation tests are needed?

  2. The readOnly test was tested with a spy test to make sure the value is set correctly. Unfortunately, H2 does not seem to support readOnly properly, so I was unable to test it.

  3. May spring test also need to test real database

Copy link
Member

@bog-walk bog-walk left a comment

Choose a reason for hiding this comment

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

Hi @FullOfOrange Thanks for putting these tests together!

Regarding your points above:

  1. Thanks for testing that the issue is actually resolved. I believe that the single connection tests, as well as the extra one, offer good coverage. At the moment I can't think up any additional cases to test, so unless you have some in mind, it's fair to set the isolation implementation as complete. If users come forward with new issues, we can then flesh out these test cases even further.
  2. & 3. Yes, unfortunately H2 only allows setting the entire database to read-only via ACCESS_MODE_DATA=r; in the driver url. So we're not able to test setting the mode via the manager. Out of curiosity, I did run a test using a PostrgeSQL datasource and was able to set the read-only mode correctly with expected results. A case like this could warrant introducing a way to delegate such a test to a representatitve database. Maybe we need to consider an alternative to SpringTransactionTestBase to run anything that can't be covered by H2.

@bog-walk bog-walk requested a review from e5l January 23, 2024 01:05
Copy link
Member

@e5l e5l left a comment

Choose a reason for hiding this comment

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

Hey @FullOfOrange, Thank you for the PR!

Good job, lgtm!

@e5l e5l merged commit 1ddde14 into JetBrains:main Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running out of connections while using non-default isolation level with SpringTransactionManager

3 participants