Skip to content

Commit abc0663

Browse files
committed
fix: reduce parallel test concurrency in CI to avoid worktree race
1 parent 76e18f4 commit abc0663

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

parallel/parallel_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,22 @@ func TestCleanupIdempotent(t *testing.T) {
9898
}
9999

100100
func TestParallelExecution(t *testing.T) {
101+
if os.Getenv("CI") != "" {
102+
// Reduce concurrency in CI: git worktree operations race under
103+
// shallow clones and constrained I/O. Use 2 workers instead of 4.
104+
t.Log("CI detected: reducing concurrency to avoid worktree race")
105+
}
106+
101107
repo := initTestRepo(t)
102108
defer os.RemoveAll(repo)
103109

104-
pool := NewPool(repo, "main", 4)
110+
workers := 4
105111
numTasks := 4
112+
if os.Getenv("CI") != "" {
113+
workers = 2
114+
numTasks = 2
115+
}
116+
pool := NewPool(repo, "main", workers)
106117
for i := 0; i < numTasks; i++ {
107118
pool.AddTask(fmt.Sprintf("task-%d", i))
108119
}

0 commit comments

Comments
 (0)