Skip to content

Add Azurite test support for AzureBlobStore - #2684

Open
Muktarsadiq wants to merge 1 commit into
TraceMachina:mainfrom
Muktarsadiq:azurite-test-support
Open

Add Azurite test support for AzureBlobStore#2684
Muktarsadiq wants to merge 1 commit into
TraceMachina:mainfrom
Muktarsadiq:azurite-test-support

Conversation

@Muktarsadiq

@Muktarsadiq Muktarsadiq commented Aug 12, 2026

Copy link
Copy Markdown

Summary

Adds Azurite (Azure Storage emulator) support to the test suite for
AzureBlobStore, Follows the same embedded-runner pattern
as mongo_runner, adapted for Azurite's constraints.

Description

Adds an embedded Azurite (Azure Storage emulator) test runner, mirroring the existing mongo_runner pattern.

Azurite has no standalone binary distribution, so the runner invokes a locally npm-installed azurite-blob directly rather than downloading one. The store is pointed at it via ExperimentalAzureSpec.sas_url rather than endpoint, since endpoint alone routes through WorkloadIdentityCredential, which Azurite cannot satisfy. A SAS signer generates both a container scoped Service SAS for test operations and an Account SAS for one time container bootstrapping, since a container SAS cannot authorize creating the container it names.

Also fixes a process crash discovered while building this: Azurite logs every request to stdout, and reading that pipe only long enough to capture the startup port left it undrained afterward, causing the next write to block and crash the whole process. stdout is now drained for the process's full lifetime instead.

Fixes #2511

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Added upload_and_get_data, upload_empty_data, and
zero_len_items_exist_check, run against a real AzureBlobStore
talking to a locally-spawned Azurite instance — no mocking. Two
#[ignore]d tests document the manual verification steps used to
validate the SAS signer and container-bootstrap logic independently
before wiring them into the automatic flow.

Note on formatting/testing: this environment doesn't have Nix
available (macOS 12/Monterey isn't supported by the current Nix
installer), so bazel test //... and the Bazel-driven nightly
rustfmt target couldn't be run directly. Ran cargo +nightly fmt
locally as the closest available equivalent, and verified everything
via cargo build --all --profile=smol / cargo test --all --profile=smol, matching what native-cargo.yaml's CI job runs.

Local setup:

cd nativelink-store/tests/azurite_runner && npm ci
cargo test -p nativelink-store --test azurite_store_test

CI: added actions/setup-node (pinned to v7.0.0) + npm ci to
native-cargo.yaml, on both OS legs, cached on
nativelink-store/tests/azurite_runner/package-lock.json.

Checklist

  • Updated documentation if needed
  • Tests added/amended
  • bazel test //... passes locally
  • PR is contained in a single commit, using git amend see some docs

This change is Reviewable

@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nativelink Ready Ready Preview Aug 13, 2026 7:44pm
nativelink-aidm Ready Ready Preview Aug 13, 2026 7:44pm

Request Review

@CLAassistant

CLAassistant commented Aug 12, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@MarcusSorealheis

Copy link
Copy Markdown
Member

Thank you for the PR. We will check it out soon!

Adds an embedded Azurite (Azure Storage emulator) test runner,
mirroring the existing mongo_runner pattern, and closes TraceMachina#2511.

Azurite has no standalone binary distribution, so the runner invokes
a locally npm-installed azurite-blob directly rather than downloading
one. The store is pointed at it via ExperimentalAzureSpec.sas_url
rather than endpoint, since endpoint alone routes through
WorkloadIdentityCredential, which Azurite cannot satisfy. A SAS
signer generates both a container scoped Service SAS for test
operations and an Account SAS for one time container bootstrapping,
since a container SAS cannot authorize creating the container it
names.

Also fixes a process crash discovered while building this: Azurite
logs every request to stdout, and reading that pipe only long enough
to capture the startup port left it undrained afterward, causing the
next write to block and crash the whole process. stdout is now
drained for the process's full lifetime instead.

CI: adds actions/setup-node and npm ci to native-cargo.yaml so
azurite-blob is available on both OS legs before cargo test runs.

@palfrey palfrey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for doing this. There's a few issues though.

- '.github/styles/**'
- 'web/**'
- ".github/styles/**"
- "web/**"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you please reset the format changes here


- name: Install Azurite for Azure store tests
run: npm ci
working-directory: nativelink-store/tests/azurite_runner

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use bun for package management, as per our existing other usage in https://github.com/TraceMachina/nativelink/blob/main/web/bun.lock

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, please make these steps a new reusable action, as they'll need to get added to various other workflows e.g. .github/workflows/nix.yaml and .github/workflows/coverage.yaml

tokio = { version = "1.52.2", features = [
"process",
"sync",
], default-features = false }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please move these further down. Our standard formatting for dependencies is the nativelink internal ones at the top, then everything else in alphabetical order after that.

"dependencies": {
"azurite": "3.36.0"
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs reformatting with the pre-commit rules. If you run the Nix setup you'll have pre-commit setup correctly as part of that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs adding to the test suite in nativelink-store/BUILD.bazel

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test Azure work with Azurite

4 participants