How can I run unit tests which require Azure Storage Emulator in the Azure Pipelines?
I have been going back and forward with this for days now and I have no idea what I’m missing, my agent uses the Windows-2022 image and according to the documentation it doesn’t have the Azure Storage Emulator anymore, so I’m downloading and running Azurite in the process as a background job (so the pipeline wouldn’t hang).
However, when I get to my unit tests, the connection is refused by Azure, I can’t find anything about why this could be happening.
Did anyone face this issue before and was able to solve it?
Just as a side note, the unit tests run fine locally and so does the emulator, below are a few screenshots from my pipeline.
Install and run Azurite script
2
Answers
It might be due to the Storage Emulator, so check the status by going to:
Run the following command-line syntax:
Prints the status of the Storage Emulator. If it’s not running do the following in order:
OR run the following
Batch Script
which will clean it, and start it up:Updated Answer, since the above applies only to the
Legacy Azure Storage Emulator
see the following suggestion. In your case is most likely the port and since you mention is a shared environment, it might be in use by another process. Seems like it truncates on theQueue Service (10001)
. You should eliminate a port misconfiguration. Define another--queuePort
or, let the system auto select an available port by running the following in console:Try using the bash task (instead of Powershell) for installing and running the azurite. That works for me…
Inline script
The raw log