Integration testing Azure Service Bus with Docker Integration testing Azure Service Bus with Docker azure azure

Integration testing Azure Service Bus with Docker


The pricing model for Service Bus has 12.5 million operations per month included for free. Past that, it's less than a dollar per millions of messages sent. With these kinds of services it should be simple for you to spin up and tear down instances with absolutely zero cost to you as part of integration tests.

NUnit, for example provides the [OneTimeSetup] and [OneTimeTearDown] methods which you could use as part of an integration test suite to provision and subsequently delete a Service Bus instance.


Sadly, I don't think Azure Storage Emulator supports the service bus yet, but you could extract the functionality to an interface and either write a fake ASB and use that or have the interface use the queue in the Emulator. If you want to use the actual ASB and don't mind incurring costs, you could spin up a new one with a guid for a name or if create evanescent queues or topics/subscriptions with guids for their names as well, then tear it all down when you're done.

Not ideal perhaps, but it gives you some options. Perhaps if you shared more detail about what you're using ASB for, we could offer better solutions.


There is a Azure Storage Emulator Docker Image in docker hub. When using it, remember that you must use Windows emulation:

enter image description here

given image can be used in docker compose:

version: '3.7'services:    azure_sb:        container_name: azure_sb        image: microsoft/azure-storage-emulator        tty: true        restart: always        ports:            - "10000:10000"            - "10001:10001"            - "10002:10002"

For test or dev usages considec using lightway version of it which is Azurite link to doc

version: '3.7'services:    azurite:        container_name: azurite        image: mcr.microsoft.com/azure-storage/azurite        tty: true        restart: always        ports:            - "10000:10000"            - "10001:10001"