-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GH-3840: Migrate Redis tests to Testcontainers #3847
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
Conversation
Fixes spring-projects#3840 * Create a new abstraction `RedisTest` for Testcontainers-based tests * Move existing common utility methods to the new interface * Migrate all existing Redis tests to use this new `RedisTest` interface * Migrate all existing Redis tests to JUnit5 * Make all existing Redis tests confirming to JUnit5 standards, such as default methods and classes visibility instead of public * Add a dependency for parametrized tests in JUnit5 * Improve assertions readability across tests, for instance: assertThat(thing.size()).isEqualTo(2) -> assertThat(thing).hasSize(2) * Add real assertions to `RedisLockRegistryTests.twoRedisLockRegistryTest` (earlier it did not have assertions at all) * Reformat, rearrange and cleanup the code
Sorry for many changes to review, but I decided that is would be better that 'chunk-based' approach. |
I also noticed that no JUnit5 tests follow the recommendation from JUnit to use default classes/methods visibility:
I removed UPD |
Hi @oxcafedead ! Thank you for your thorough contribution as usual! Re. It is really some burden to remove all those And from the JUnit doc you've mentioned:
So, doesn't look like there is a strong requirement to do that extra work removing the Therefore there is no any convention from our side how to be with such a migration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple nit-picks.
Otherwise this is great work, @oxcafedead , as usual!
spring-integration-redis/src/test/java/org/springframework/integration/redis/RedisTest.java
Outdated
Show resolved
Hide resolved
spring-integration-redis/src/test/java/org/springframework/integration/redis/RedisTest.java
Outdated
Show resolved
Hide resolved
...n-redis/src/test/java/org/springframework/integration/redis/util/RedisLockRegistryTests.java
Outdated
Show resolved
Hide resolved
Fix a couple of small changes after the code review: * Change base interface name to be consistent with other similar places * Typo in javadocs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Pulling locally for final verification and merging...
Small tests readability improvement regarding assertions
Merged as 1c461a3 after some minor compatibility fix. thank you again. |
Fixes #3840
RedisTest
for Testcontainers-based testsRedisTest
interfacedefault methods and classes visibility instead of public
assertThat(thing.size()).isEqualTo(2) -> assertThat(thing).hasSize(2)
RedisLockRegistryTests.twoRedisLockRegistryTest
(earlier it did nothave assertions at all)