| 2206 | } |
| 2207 | |
| 2208 | func TestRunOnceSharedDeps(t *testing.T) { |
| 2209 | t.Parallel() |
| 2210 | |
| 2211 | const dir = "testdata/run_once_shared_deps" |
| 2212 | |
| 2213 | var buff bytes.Buffer |
| 2214 | e := task.NewExecutor( |
| 2215 | task.WithDir(dir), |
| 2216 | task.WithStdout(&buff), |
| 2217 | task.WithStderr(&buff), |
| 2218 | task.WithForceAll(true), |
| 2219 | ) |
| 2220 | require.NoError(t, e.Setup()) |
| 2221 | require.NoError(t, e.Run(t.Context(), &task.Call{Task: "build"})) |
| 2222 | |
| 2223 | rx := regexp.MustCompile(`task: \[service-[a,b]:library:build\] echo "build library"`) |
| 2224 | matches := rx.FindAllStringSubmatch(buff.String(), -1) |
| 2225 | assert.Len(t, matches, 1) |
| 2226 | assert.Contains(t, buff.String(), `task: [service-a:build] echo "build a"`) |
| 2227 | assert.Contains(t, buff.String(), `task: [service-b:build] echo "build b"`) |
| 2228 | } |
| 2229 | |
| 2230 | func TestRunWhenChanged(t *testing.T) { |
| 2231 | t.Parallel() |