-
-
Notifications
You must be signed in to change notification settings - Fork 350
Open
Description
Type: Feature
Is your feature request related to a problem? Yes
While performing sequential IT tests, I often encounter the issue where the SQSListener bean is not cleared between tests, which makes it challenging to conduct real IT tests.
Describe the solution you'd like
Ability for the Spring Cloud AWS test context to be cleaned between test classes without the use of @DirtiesContext
.
Describe alternatives you've considered
- Using the
@DirtiesContext
works, but then tests will take much more time to run. - Doing almost the full IT. Bypassing the first step of sending the message to the localstack SQS and doing it by calling the listener method with the object directly.
Additional context
- I have a replicator project where to replicate this issue, I need to launch a WireMock server per test class, and if I don't do it, the issue doesn't happen. However, this is happening to me in other, more complex projects that don't use WireMock, which I can't share. That's why I think this is a behavior with Spring Cloud AWS.
- The replicator https://github.com/MarcoMartins86/spring-issue-replicator#
- Run
mvn clean install
, the test that fails is where the issue is happening, and we can see in the output something likeListener from [Test1] consuming message from [Test3]
, which means that the bean of another test was not destroyed between test classes and consumed the message. - You can uncomment the
//@DirtiesContext
inIntegrationTest
and run again to see they will all pass now. - Please do take a look. Thank you.
Metadata
Metadata
Assignees
Labels
No labels