question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running azurite for tests in a GitHub action

See original GitHub issue

Which service(blob, file, queue, table) does this issue concern?

Blob

Which version of the Azurite was used?

3.7.0

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

npm

What’s the Node.js version?

11

What problem was encountered?

Running azurite in a GitHub action to allow tests to run

Steps to reproduce the issue?

I’m running the following in my action:

    - name: Install NPM
      uses: actions/setup-node@v1
      with:
        node-version: '12'
    - run: npm install -g azurite
    - shell: cmd
      run: start /B azurite-blob
    - name: Run tests
      run: dotnet test ./src/ServiceBus.AttachmentPlugin.sln --configuration Release  --no-restore  --verbosity normal

Can see azurite is running, but tests are failing to connect.

image

Tests execution: image

Is this a correct way to run azurite when using GitHub actions? The workflow I’m using fails to execute tests that are connecting to the development storage account.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15

github_iconTop GitHub Comments

4reactions
ethomsoncommented, Jun 5, 2020

Apologies 😄, I was under the impression that the behaviour behind getting a new shell would also destroy any processes started under it.

No apology needed - I’m not sure of the precise mechanics around start /B behavior or background processes in Windows. And I think that you’re right, this does actually appear to be a somewhat different concept.

The docs say:

Starts an application without opening a new Command Prompt window. CTRL+C handling is ignored unless the application enables CTRL+C processing. Use CTRL+BREAK to interrupt the application.

It sounds like this doesn’t really put something in the background - at least in the Unix sense - as much as it means that the new process just has the I/O of the existing window, and that this is tied to the current console:

Now the problem is that when a console window is closed, any process associated with this console will also be closed.

Changing this to bash and putting it in the background with & seems to get the process running correctly.

- run: npm install -g azurite
- shell: bash
  run: azurite-blob &

@ethomson, is there anyone at GitHub Actions team that can look into this?

The best place to get help is github.community - support, engineering and product members of the Actions team hang out there.

0reactions
IGx89commented, Oct 5, 2022

FYI there’s an even simpler solution available now, by running Azurite in a Docker container as part of your job. Just add the following under your job, above steps:

    services:
      azurite:
        image: mcr.microsoft.com/azure-storage/azurite
        ports:
          - 10000:10000
          - 10001:10001
          - 10002:10002

This follows the same approach recommended for Redis here: https://docs.github.com/en/actions/using-containerized-services/creating-redis-service-containers

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running Azurite Azure Storage Emulator in GitHub Actions
To run some tests on the CI pipeline I'm using the new Azurite tool, a cross-plattfrom Storage Account emulator that is perfect for...
Read more >
Using Azurite to Run Blob Storage Tests in a Pipeline
Install and run Azurite for local tests: · In Azure Storage Explorer, select Attach to a local emulator · Provide a Display name...
Read more >
How to run Azure Storage unit tests in CI - Today I Learned
The first line will install it, and the second will start it in a background process. Tests will need to use CloudStorageAccount.
Read more >
How to make integration test for Azure Storage in C# – Part 3
When pushing code to GitHub and testing it via GitHub actions, ... and call it AzuriteContainer.cs that will consume azurite docker via C#....
Read more >
How to integration test Azure Blob Storage? - Stack Overflow
Ensure that Azurite is up and running on the docker desktop. ... pull and fire up Azurite for testing locally and in GitHub...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found