Skip to content

Commit 47c2b2e

Browse files
authored
test(integration): cover the premade NixOS base image in the distro matrix (#3498)
Adds the premade NixOS image to `TestTemplateBuildDistroFamilies`, so CI catches a base image that doesn't boot. The tar-only publish gate in `nixos-base-image.yml` provably can't: the pre-shim 26.05 image passed every tar assertion and still froze at boot with no units. The profile installs nothing, so reaching ready proves exactly the parts that are ours — the busybox `Bootstrap`, the `/sbin/e2b-nixos-init` shim (#3478), and the `rm -rf /etc/systemd/system` that lets `setup-etc` take over. **Immutable tag, never `:latest`** — `phases/base/hash.go` keys the base layer on `Config.FromImage` as written, so a republished `:latest` would keep building from the stale cached layer and a failure wouldn't reproduce. **Cost, measured on this run.** Lands in `templates-builds-2` (`Distro` misses `TEMPLATE_BUILDS_SHARD1_RE`). The subtest is **156s** — 515 MB compressed / 1.05 GiB unpacked, cold pull every time. Package wall 166s → 255s, job **5.7 → 7.2 min** against a 30 min cap. It grows the wall by more than 156/4 because the pull and unpack also slow its three concurrent neighbours (utilisation 3.7× → 3.0×). That makes shard 2 the long pole against shard 1's 4m52s; leaving `TEMPLATE_BUILDS_SHARD1_RE` alone — that 2.3 min gap wants its own measuring run, the way #3479 did it. **`compression-tests.tsv`: no change.** The test is already absent; the documented criterion is reading a snapshot back, and provisioning is compression-invariant like the other four cases. Entries are per top-level test anyway, so a subtest couldn't be listed on its own.
1 parent 80fe746 commit 47c2b2e

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎tests/integration/internal/tests/api/templates/distro_build_test.go‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import (
1515
// own package names under set -e, links its own init binary and regenerates its
1616
// own CA bundle, so a build that reaches ready with the start and ready commands
1717
// executed proves the whole profile resolves and that envd boots under it.
18+
//
19+
// NixOS installs nothing — see its case below — so there the same assertions
20+
// prove the boot path rather than the package set.
1821
func TestTemplateBuildDistroFamilies(t *testing.T) {
1922
t.Parallel()
2023

@@ -43,6 +46,22 @@ func TestTemplateBuildDistroFamilies(t *testing.T) {
4346
templateName: "test-distro-alpine",
4447
fromImage: "alpine:3.24",
4548
},
49+
// Premade, so the profile declares no packages and a PkgInstall that
50+
// exits 1: everything provisioning installs elsewhere is baked into the
51+
// image's own NixOS configuration. Reaching ready therefore proves the
52+
// parts that are still ours — the busybox Bootstrap standing in for the
53+
// FHS userland the image has no /bin/sh for before its first activation,
54+
// the /sbin/e2b-nixos-init activation shim, and the drop-in removal that
55+
// lets setup-etc take over /etc/systemd/system.
56+
//
57+
// Pinned to the immutable tag, never :latest: the base-layer cache key is
58+
// the image reference as written (phases/base/hash.go), so a republished
59+
// :latest would keep building from the stale cached layer.
60+
{
61+
name: "NixOS premade",
62+
templateName: "test-distro-nixos",
63+
fromImage: "e2bdev/nixos:26.05-20260731",
64+
},
4665
}
4766

4867
for _, tc := range testCases {

0 commit comments

Comments
 (0)