test(implementation-sweep): supply the binaries the missing-binary test does not test

resolveBinaries ranges a map, so with more than one binary absent the
error named whichever it reached first. The test passed locally only
because bun and sanderling were on PATH; on CI it was a three-way coin
flip.
This commit is contained in:
pj committed 2026-08-17 23:44:26 +05:30
1 parent 071f9c7f52
commit 5651adb439
1 file changed
+14 -5
@@ -65,19 +65,28 @@ func TestDiscoverImplementations_EmptyDirectoryIsRefused(t *testing.T) {
func TestRunSweep_StopsBeforeItInstallsAnythingWhenABinaryIsMissing( func TestRunSweep_StopsBeforeItInstallsAnythingWhenABinaryIsMissing(
t *testing.T, t *testing.T,
) { ) {
implementations := t.TempDir() root := t.TempDir()
implementations := filepath.Join(root, "implementations")
if err := os.MkdirAll(filepath.Join(implementations, "impl-01"), 0o755); err != nil { if err := os.MkdirAll(filepath.Join(implementations, "impl-01"), 0o755); err != nil {
t.Fatal(err) t.Fatal(err)
} }
output := filepath.Join(t.TempDir(), "campaigns") output := filepath.Join(root, "campaigns")
configuration := config{ configuration := config{
implementationsDirectory: implementations, implementationsDirectory: implementations,
outputDirectory: output, outputDirectory: output,
basePort: 5300, basePort: 5300,
concurrency: 1, concurrency: 1,
bunPath: "bun", bunPath: writeScript(
campaignPath: "campaign-that-is-not-installed", t,
sanderlingPath: "sanderling", filepath.Join(root, "stub-bun"),
"#!/bin/sh\nexit 0\n",
),
campaignPath: "campaign-that-is-not-installed",
sanderlingPath: writeScript(
t,
filepath.Join(root, "stub-sanderling"),
"#!/bin/sh\nexit 0\n",
),
} }
err := runSweep(t.Context(), configuration, os.Stdout) err := runSweep(t.Context(), configuration, os.Stdout)
if err == nil || !strings.Contains(err.Error(), "--campaign") { if err == nil || !strings.Contains(err.Error(), "--campaign") {