Skip to content

Conversation

@UnstoppableMango
Copy link

Adds a module for the Azure Service Bus Emulator. Based heavily on the Go implemenatation.

I have a few open questions:

  • Go has a single azure module encapsulating multiple Azure services including the emulator, should this be replicated in node?
  • The Service Bus Emulator depends on an MSSQL Server instance, of which a module already exists. We could re-use the module, but currently there are no other modules that depend on each other. I've copy-pasted the MSSQL container, but I'm certain this should be done differently
  • The emulator exposes ports 5672 and 5300, but for some reason the port wait strategy never recognizes these as bound. This seems to be working fine in Go, I'm not sure what the difference is here. I've omitted the port strategy currently but this should probably be added back

Resolves #1082

@netlify
Copy link

netlify bot commented Dec 3, 2025

Deploy Preview for testcontainers-node ready!

Name Link
🔨 Latest commit b54a6dd
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-node/deploys/693a07531eac8e00089c34af
😎 Deploy Preview https://deploy-preview-1194--testcontainers-node.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cristianrgreco
Copy link
Collaborator

Thanks for raising the PR @UnstoppableMango, I'm a bit swamped at the moment but will look into it as soon as I can

@cristianrgreco cristianrgreco added enhancement New feature or request minor Backward compatible functionality labels Dec 4, 2025
@weyert
Copy link
Contributor

weyert commented Dec 5, 2025

Nice looks great! Excited to give it a try :) :)

@cristianrgreco
Copy link
Collaborator

cristianrgreco commented Dec 6, 2025

@UnstoppableMango:

  • Single azure module vs multiple: I would have preferred a single module, like we have for gcloud, but unfortunately we already have azurecosmosdb as a separate module. I'm leaning towards making this a separate module (as you have already), and in the future we'll release a major version which unifies them into a single azure module
  • Dependency on MSSQL server container: As the maintainer it pains me to duplicate code, but I am also leaning towards copy/pasting the MSSQL container - it'll make the dependency constraints between modules quite complex otherwise. Let's aim to keep the MSSQL container as minimal as possible to minimize maintenance effort, it shouldn't need all the features of the standalone one right?
  • Port wait strategy not working: This one needs more looking at - if you were to debug at the point the container has started, are you able to for example netcat the container ports?

Thanks for raising the PR, it's already in very good condition!

@UnstoppableMango
Copy link
Author

Alright, I refactored the MSSQL container into a generic container so it's no longer a copy-paste of the module. I also added a test to demonstrate that the user needs to manually configure the SA password when using a custom container.

I did some more debugging around the ports and I think the problem is really that the emulator image is minimal and doesn't contain any tools, including a shell like sh. The Go module has this same problem, but the wait logic appears to ignore missing shells and drop the error.

I was able to work around this by extending the emulator image to install sh and nc, but that feels overkill to me. Open to suggestions, but perhaps the health check wait strategy is enough?

@UnstoppableMango UnstoppableMango marked this pull request as ready for review December 9, 2025 22:58
Copilot AI review requested due to automatic review settings December 9, 2025 22:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new module for the Azure Service Bus Emulator to the testcontainers-node library. The module provides a convenient way to run Azure Service Bus in a containerized environment for testing purposes.

  • Introduces the ServiceBusContainer and StartedServiceBusContainer classes
  • Automatically manages a dependent MSSQL Server container required by the emulator
  • Provides helper methods for configuration and connection string generation

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
packages/modules/azureservicebus/src/azureservicebus-container.ts Main container implementation with MSSQL dependency management
packages/modules/azureservicebus/src/azureservicebus-container.test.ts Comprehensive test suite covering basic usage, custom config, and custom MSSQL container scenarios
packages/modules/azureservicebus/src/index.ts Module entry point (missing exports)
packages/modules/azureservicebus/package.json Package configuration with dependencies
packages/modules/azureservicebus/tsconfig.json TypeScript configuration for development
packages/modules/azureservicebus/tsconfig.build.json TypeScript build configuration
packages/modules/azureservicebus/Dockerfile Dockerfile specifying the emulator image
docs/modules/azureservicebus.md Documentation with usage examples
mkdocs.yml Documentation navigation update
package-lock.json Dependency lock file updates for Azure SDK packages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Tests, readme, and more impl

Fix test

Move doc block

Fix docs
Refactoring, more tests, and PR comment

Bump versions

Lint

PR comment

I can't spell + PR comments
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 10 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cristianrgreco
Copy link
Collaborator

@UnstoppableMango please check the review comments. Apart from the password strength (I guess it's fine considering the container starts?), I think they're all somewhat valid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request minor Backward compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Azure Service Bus via its Emulator

3 participants