-
-
Notifications
You must be signed in to change notification settings - Fork 291
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
feat(servicebus): Add support to use a custom MsSqlContainer instance with Service Bus emulator #1335
base: develop
Are you sure you want to change the base?
Conversation
… ServiceBusContainer
✅ Deploy Preview for testcontainers-dotnet ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
var typeAssemblyName = containerType.Assembly.GetName().Name; | ||
|
||
if (!string.IsNullOrWhiteSpace(testAssemblyName) && !string.IsNullOrWhiteSpace(typeAssemblyName) && !testAssemblyName.Contains(typeAssemblyName)) | ||
{ | ||
continue; | ||
} | ||
|
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.
When adding a new test that creates an MS SQL instance, the MsSqlContainer
type was exported under Testcontainers.ServiceBus.Tests.dll
. This caused the test to detect IContainer
implementations that aren’t part of the Service Bus assembly. Ideally, verifying that MsSqlContainer
implements IDatabaseContainer
should happen in its theory case (Testcontainers.MsSql.Tests
), rather than in the Testcontainers.ServiceBus.Tests.dll
theory case.
I’d appreciate any suggestions on how to handle these cross-assembly references without causing false positives.
What does this PR do?
This PR exposes an overload of
WithMsSqlContainer
, enabling users to attach an existingMsSqlContainer
instance to the Azure Service Bus emulator. Previously, ServiceBusContainer automatically spun up its own SQL Server container, leading to unnecessary duplication when users were already testing with Azure Service Bus and SQL Server (see #1323).Why is it important?
This enhancement addresses the resource usage issues described in #1323. By allowing a single
MsSqlContainer
to be shared, the overhead of launching a separate SQL Server container to use the Azure Service Bus emulator is eliminated. This can be especially beneficial in CI/CD scenarios or other environments where minimizing resource consumption and reducing test execution time is a priority.Related issues
How to test this PR
MsSqlContainer
toServiceBusContainer
.ServiceBusContainer
andMsSqlContainer
) are on the same network.mcr.microsoft.com/azure-sql-edge:latest
.mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04
(the default inMsSqlBuilder
) is not spun up.Follow-ups
None at this time. Inline summary documentation is included in the new overload.