Commit a2eb462
Eric Bower
·
2026-08-11 11:39:25 -0400 EDT
parent fc37682
fix: tests
2 files changed,
+16,
-2
+1,
-0
1@@ -1,3 +1,4 @@
2 pici
3 .env
4 .envrc
5+testrepo/
+15,
-2
1@@ -980,6 +980,10 @@ func TestWorkspaceRsync_ExcludesGitAndJJ(t *testing.T) {
2 }
3
4 func TestRunnerDoesNotCreatePublishedSentinel(t *testing.T) {
5+ if _, err := exec.LookPath("zmx"); err != nil {
6+ t.Skip("zmx not found, skipping test")
7+ }
8+
9 tmpDir := t.TempDir()
10 artifactDir := filepath.Join(tmpDir, "artifacts")
11 wkDir := filepath.Join(tmpDir, "workspace")
12@@ -999,7 +1003,7 @@ zmx wait "*"
13
14 jobID := "j-no-published-test"
15 event := Event{
16- Type: "git.push",
17+ Type: "local",
18 Name: "no-published-repo",
19 JobID: jobID,
20 Workspace: wkDir,
21@@ -1010,7 +1014,7 @@ zmx wait "*"
22 Logger: slog.New(slog.NewTextHandler(io.Discard, nil)),
23 ArtifactDir: artifactDir,
24 EventSource: io.NopCloser(bytes.NewReader(append(eventJSON, '\n'))),
25- NewWorkspace: defaultWorkspaceFactory,
26+ NewWorkspace: func(cfg *Cfg, logger *slog.Logger, source string) Workspace { return &mockLocalWorkspace{dir: source} },
27 SessionPrefix: "test.",
28 }
29
30@@ -1023,3 +1027,12 @@ zmx wait "*"
31 t.Errorf("expected published.json NOT to exist after RunRunner, but it exists at %s", sentinel)
32 }
33 }
34+
35+type mockLocalWorkspace struct {
36+ dir string
37+}
38+
39+func (w *mockLocalWorkspace) Setup() error { return nil }
40+func (w *mockLocalWorkspace) Cleanup() error { return nil }
41+func (w *mockLocalWorkspace) GetDir() string { return w.dir }
42+func (w *mockLocalWorkspace) Checksum() string { return "" }