Repository navigation
Run the NMS integration tests against an ActiveMQ Testcontainer - #392
Merged
Merged
Conversation
Spring.Messaging.Nms.Integration.Tests now provisions its own broker: an apache/activemq-classic:6.2.0 container, started with Testcontainers' generic ContainerBuilder, on a random host port, and ready once the broker logs that the OpenWire connector started. test/Shared/ActiveMqTestEnvironment.cs (linked, shaped like SqlServerTestEnvironment) publishes SPRING_TEST_ACTIVEMQ_BROKER_URI; if that variable is already set, no container is started. - The project multi-targets net10.0 and net472: Apache.NMS.ActiveMQ 2.3.0 is netstandard2.0, so the net472-only reference was a leftover. - The XML contexts read the broker URI through VariablePlaceholderConfigurer. - ConnectionThrowException runs on both TFMs and uses a host that can never resolve (.invalid); the listener test waits on a semaphore, not a sleep. - The IntegrationTest target runs the project; --test-integration-nms still adds it to Test. An external broker or SQL Server serializes the modules. - Directory.Packages.props: Testcontainers 4.16.0 (same as Testcontainers.MsSql). - README and AGENTS.md describe the broker and the override variable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LGkLQuAuUjvRjrU1AcTsmk Signed-off-by: Marko Lahma <marko.lahma@gmail.com>
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.
Spring.Messaging.Nms.Integration.Testsnow starts its own ActiveMQ broker through Testcontainers, with the same setup #390 uses for SQL Server. It runs in theIntegrationTesttarget and theintegration-linuxCI job, on both TFMs.test/Shared/ActiveMqTestEnvironment.csruns ActiveMQ Classic (apache/activemq-classic:6.2.0), the brokerApache.NMS.ActiveMQ's OpenWire client is written for.ContainerBuilder. The OpenWire port is bound to a random host port.SPRING_TEST_ACTIVEMQ_BROKER_URI. If that variable is already set, it uses that broker and starts no container.SqlServerTestEnvironment.${SPRING_TEST_ACTIVEMQ_BROKER_URI}throughVariablePlaceholderConfigurerinstead of hard-codingtcp://localhost:61616.Apache.NMS.ActiveMQ2.3.0 ships only netstandard2.0, so the net472-only package condition was a leftover. The project now targetsnet10.0;net472, andConnectionThrowExceptionis no longer limited to .NET Framework.SendAndRecieveAsyncslept for a second and called that an assertion. It now waits, with a 30-second timeout, for a signal from the listener.Interlocked; the container runs with concurrency 10.ConnectionThrowExceptionexpects a connection failure, and it only got one because of the typotcp://localaaahost. It now uses the reserved.invalidTLD (RFC 6761), so it fails deterministically.IntegrationTestpicks up the NMS project.--test-integration-nmsselects it.Testcontainers4.16.0, the same version asTestcontainers.MsSql. It is test-only.Verification
./build.cmd Compile IntegrationTestpasses locally. NMS: 3/3 on net10.0 and 3/3 on net472. The SQL suites are unchanged from Run the SQL Server integration tests on Testcontainers, with a CI job #390../build.cmd Test --test-integration-nmsruns the project.FormatUsingDefaults.🤖 Generated with Claude Code
https://claude.ai/code/session_01LGkLQuAuUjvRjrU1AcTsmk