testcontainers-node icon indicating copy to clipboard operation
testcontainers-node copied to clipboard

Add an Azure Service Bus Emulator module

Open UnstoppableMango opened this issue 1 month ago • 6 comments

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

UnstoppableMango avatar Dec 03 '25 16:12 UnstoppableMango

Deploy Preview for testcontainers-node ready!

Name Link
Latest commit 6c3d3c114c503824688b8146fa7a27c55de2f642
Latest deploy log https://app.netlify.com/projects/testcontainers-node/deploys/693ca68591766600078b931f
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.

netlify[bot] avatar Dec 03 '25 16:12 netlify[bot]

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 avatar Dec 04 '25 09:12 cristianrgreco

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

weyert avatar Dec 05 '25 00:12 weyert

@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!

cristianrgreco avatar Dec 06 '25 11:12 cristianrgreco

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 avatar Dec 09 '25 22:12 UnstoppableMango

@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

cristianrgreco avatar Dec 10 '25 11:12 cristianrgreco