Commit a2eb462
Eric Bower
·
2026-08-11 11:39:25 -0400 EDT
parent fc37682
fix: tests
2 files changed,
+16,
-2
+1,
-0
+15,
-2
| ... | ... | @@ -980,6 +980,10 @@ func TestWorkspaceRsync_ExcludesGitAndJJ(t *testing.T) { | |
| 980 | 980 | } | |
| 981 | 981 | ||
| 982 | 982 | func TestRunnerDoesNotCreatePublishedSentinel(t *testing.T) { | |
| 983 | + | if _, err := exec.LookPath("zmx"); err != nil { | |
| 984 | + | t.Skip("zmx not found, skipping test") | |
| 985 | + | } | |
| 986 | + | ||
| 983 | 987 | tmpDir := t.TempDir() | |
| 984 | 988 | artifactDir := filepath.Join(tmpDir, "artifacts") | |
| 985 | 989 | wkDir := filepath.Join(tmpDir, "workspace") |
| ... | ... | @@ -999,7 +1003,7 @@ zmx wait "*" | |
| 999 | 1003 | ||
| 1000 | 1004 | jobID := "j-no-published-test" | |
| 1001 | 1005 | event := Event{ | |
| 1002 | - | Type: "git.push", | |
| 1006 | + | Type: "local", | |
| 1003 | 1007 | Name: "no-published-repo", | |
| 1004 | 1008 | JobID: jobID, | |
| 1005 | 1009 | Workspace: wkDir, |
| ... | ... | @@ -1010,7 +1014,7 @@ zmx wait "*" | |
| 1010 | 1014 | Logger: slog.New(slog.NewTextHandler(io.Discard, nil)), | |
| 1011 | 1015 | ArtifactDir: artifactDir, | |
| 1012 | 1016 | EventSource: io.NopCloser(bytes.NewReader(append(eventJSON, '\n'))), | |
| 1013 | - | NewWorkspace: defaultWorkspaceFactory, | |
| 1017 | + | NewWorkspace: func(cfg *Cfg, logger *slog.Logger, source string) Workspace { return &mockLocalWorkspace{dir: source} }, | |
| 1014 | 1018 | SessionPrefix: "test.", | |
| 1015 | 1019 | } | |
| 1016 | 1020 |
| ... | ... | @@ -1023,3 +1027,12 @@ zmx wait "*" | |
| 1023 | 1027 | t.Errorf("expected published.json NOT to exist after RunRunner, but it exists at %s", sentinel) | |
| 1024 | 1028 | } | |
| 1025 | 1029 | } | |
| 1030 | + | ||
| 1031 | + | type mockLocalWorkspace struct { | |
| 1032 | + | dir string | |
| 1033 | + | } | |
| 1034 | + | ||
| 1035 | + | func (w *mockLocalWorkspace) Setup() error { return nil } | |
| 1036 | + | func (w *mockLocalWorkspace) Cleanup() error { return nil } | |
| 1037 | + | func (w *mockLocalWorkspace) GetDir() string { return w.dir } | |
| 1038 | + | func (w *mockLocalWorkspace) Checksum() string { return "" } |