fix(notification): disable mail health contributor in DlqIntegrationTest#31
Merged
Conversation
@MockitoBean replaces JavaMailSenderImpl with a mock; MailHealthContributorAutoConfiguration requires a concrete implementation and fails with 'beans must not be empty' on CI. Disabling the mail health check in this test context fixes the context startup failure.
…olling queue DeadLetterConsumer actively acks messages from the DLQ so rabbitTemplate.receive() always returns null. Use @MockitoSpyBean to verify the consumer was called instead.
…tegration test @MockitoSpyBean cannot intercept @RabbitListener calls because Spring AMQP captures the original bean reference before the spy wrapper is applied. Assign a stable ID to the DLQ listener and stop it via the registry before the test so messages remain in the queue for direct polling.
The test classpath application.yaml replaces the production one, losing retry.enabled=true. Without retry the listener nacks with requeue=true and RabbitMQ redelivers the message forever instead of routing to the DLQ. Adding retry.enabled=true to @DynamicPropertySource activates Spring AMQP's in-memory retry interceptor, which rejects with requeue=false after max-attempts and triggers dead-letter routing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@MockitoBean replaces JavaMailSenderImpl with a mock; MailHealthContributorAutoConfiguration requires a concrete implementation and fails with 'beans must not be empty' on CI. Disabling the mail health check in this test context fixes the context startup failure.