Skip to content

Do not share store between builder and queue runner in unit tests#1642

Merged
Ericson2314 merged 1 commit intoNixOS:masterfrom
obsidiansystems:test-multi-store
Apr 8, 2026
Merged

Do not share store between builder and queue runner in unit tests#1642
Ericson2314 merged 1 commit intoNixOS:masterfrom
obsidiansystems:test-multi-store

Conversation

@Ericson2314
Copy link
Copy Markdown
Member

No description provided.

@Ericson2314 Ericson2314 force-pushed the test-multi-store branch 5 times, most recently from 94b39c3 to 3e737bb Compare April 7, 2026 18:05
A handful of test infrastructure fixes needed once the queue runner and
builder use distinct physical Nix stores sharing the same logical
store dir.

- `HydraTestContext`: create the builder and central roots up front
  with `make_path` (the `local?root=...` store won't initialise
  otherwise), and give the builder its own `nix_state_dir` /
  `nix_log_dir` fields alongside the existing `nix_store_dir`.

- `QueueRunnerBuildOne`:
  - Set `NIX_STORE_DIR` when starting `hydra-builder` with a `TODO`
    note: the builder currently reads this to advertise its logical
    store dir to the queue runner; it should take the value from the
    store URI instead.
  - Pump the queue-runner `IPC::Run` harness alongside the builder
    and flush accumulated stderr on every poll, so when a test hangs
    we actually see the queue runner's logs instead of a blank
    "Builder stderr: ..." wall.

- `queue-runner/notifications.t`: the "prebuild into a binary cache"
  preamble uses `nix-build` / `nix copy` / `nix log` / `nix-store`
  directly, which inherits the central store URI. That store has
  physical != logical, so building derivations whose `$PATH` points
  at the host `/nix/store/...-coreutils/bin` fails with `mkdir: not
  found`. Point all of these at the builder store (which has physical
  = logical) via `--store`, and clean up the builder's log dir at
  the end of the subtest instead of the central one.

  This also makes sure that the test doesn't rely on `nix-build` etc.
  doing things to the central / queue runner's store that we didn't
  realize, so we don't accidentally rely on those things (e.g. the test
  would fail without them.)
@Ericson2314 Ericson2314 marked this pull request as ready for review April 8, 2026 16:14
@Ericson2314 Ericson2314 enabled auto-merge April 8, 2026 16:14
@Ericson2314 Ericson2314 added this pull request to the merge queue Apr 8, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to invalid changes in the merge commit Apr 8, 2026
@Ericson2314 Ericson2314 added this pull request to the merge queue Apr 8, 2026
@Ericson2314 Ericson2314 removed this pull request from the merge queue due to a manual request Apr 8, 2026
@Ericson2314 Ericson2314 added this pull request to the merge queue Apr 8, 2026
Merged via the queue into NixOS:master with commit cd235f7 Apr 8, 2026
2 checks passed
@Ericson2314 Ericson2314 deleted the test-multi-store branch April 8, 2026 17:17
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.

2 participants