Skip to content

Add Azurite test support for AzureBlobStore - #2684

Open
Muktarsadiq wants to merge 3 commits into
TraceMachina:mainfrom
Muktarsadiq:azurite-test-support
Open

Muktarsadiq wants to merge 3 commits into
TraceMachina:mainfrom
Muktarsadiq:azurite-test-support

Conversation

@Muktarsadiq

@Muktarsadiq Muktarsadiq commented Aug 12, 2026 •

Copy link
Copy Markdown

What and why

Adds Azurite (Azure Storage emulator) support to the test suite for
AzureBlobStore, so it's exercised against a real emulator rather than
only mocks. Follows the existing mongo_runner embedded-runner pattern.

Fixes #2511

How was this verified?

Ran cargo test -p nativelink-store --test azurite_store_test locally:
upload_and_get_data, upload_empty_data, and
zero_len_items_exist_check all pass against a real AzureBlobStore
talking to a locally spawned Azurite instance no mocking. Two
#[ignore]d tests document manual verification of the SAS signer and
container-bootstrap logic, done independently before wiring them into
the automatic flow.

Also ran the full suite under Bazel/Nix per review feedback
(bazel-retry test //nativelink-store:integration ...): 25/27 pass.
The 2 known failures are azurite_store_test_test (Bazel's sandboxed
test execution has no network access to run bun install, so
azurite-blob isn't present at runtime, same root cause as the
p.mongodb symlink hack mongo_runner needs in flake.nix) and a
one-off grpc_store_test_test timeout that passes cleanly in
isolation, confirmed as resource pressure flakiness rather than a
real regression.

Fixed 11 Clippy findings surfaced by the Bazel/Nix run (import
ordering, tokio::spawn → nativelink_util::background_spawn!, doc
comment formatting, #[tokio::test] → #[nativelink_test], etc.),
and a Windows-specific bug where the runner looked for azurite-blob
without the .cmd extension npm/bun generate on that platform.

Could not verify bazel test //... (full monorepo) or the Nix-driven
pre-commit hooks directly at first, due to macOS 12/Monterey being
unsupported by the current Nix installer. Later verified both via an
Ubuntu VM once set up.

Risk

Low. This is purely additive test infrastructure, no production code
(azure_blob_store.rs itself) is touched beyond adapting one call site
to match its async/non-async signature after an unrelated upstream
Rust 1.97.1 toolchain bump changed it mid-review. New dev-only
dependencies (chrono, hmac) and a Bun-based install step affect
test builds and CI only, not the shipped nativelink binary. The known
gap is that the new Azurite tests don't yet execute under Bazel/Nix's
sandboxed test paths (see above), a coverage gap for this new suite,
not a regression, since the existing mocked azure_blob_store_test.rs
still runs everywhere unaffected.

AI assistance

Used GitHub Copilot to help diagnose several CI failure logs during
review (Clippy findings, a stale commit false positive on an
AzureBlobStore::new() signature question, and the PR-template check
itself), verified each suggestion against the actual source/log
output before applying, and caught at least one incorrect diagnosis
from it in the process.


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
nativelink Ready Ready Preview Oct 5, 2026 10:09am UTC
nativelink-aidm Ready Ready Preview Oct 5, 2026 10:09am UTC

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!

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

Comment thread .github/workflows/native-cargo.yaml Outdated
Comment thread .github/workflows/native-cargo.yaml Outdated
Comment thread nativelink-store/Cargo.toml Outdated
Comment thread nativelink-store/tests/azurite_runner/package.json
Comment thread nativelink-store/tests/azurite_store_test.rs
@Muktarsadiq
Muktarsadiq force-pushed the azurite-test-support branch from 419234e to 6a12eca Compare August 24, 2026 11:12
@github-actions

This comment has been minimized.

Comment thread nativelink-store/BUILD.bazel Outdated
@palfrey

palfrey commented Aug 25, 2026

Copy link
Copy Markdown
Member

I would suggest running all of this locally under Bazel with nix, so you can fix the variety of lint failures there as well as run pre-commit run -a to fix all the pre-commit issues currently being flagged in the build.

@Muktarsadiq

Copy link
Copy Markdown
Author

Ran bazel-retry test //nativelink-store:integration under Nix. 25/27 pass. The 2 failures were azurite_store_test_test fails exactly as flagged in my earlier comment (sandbox has no network to run bun install), and grpc_store_test_test failed on an unrelated pre existing test with a hardcoded 5s timeout, which I believe was resource pressure flakiness on my VM rather than a real regression

@MarcusSorealheis

Copy link
Copy Markdown
Member

@Muktarsadiq You are very close. Let me know if you need any help. The answer is in the logs here.

Comment thread nativelink-store/tests/azurite_store_test.rs Outdated
Comment thread nativelink-store/tests/azurite_runner/mod.rs Outdated
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.

This branch was successfully deployed

2 active deployments
Preview – nativelink — 90f47ecf Deployed Oct 5, 2026 by vercel[bot]
Preview – nativelink-aidm — 90f47ecf Deployed Oct 5, 2026 by vercel[bot]
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