diff --git a/pkg/mutator/mutator.go b/pkg/mutator/mutator.go index 053a8f21..ceaae6c5 100644 --- a/pkg/mutator/mutator.go +++ b/pkg/mutator/mutator.go @@ -298,6 +298,7 @@ func (mu *Mutator) getTestArgs() []string { if mu.buildTags != "" { args = append(args, "-tags", mu.buildTags) } + args = append(args, "-timeout", (1*time.Second + mu.testExecutionTime).String()) args = append(args, "./...") return args diff --git a/pkg/mutator/mutator_test.go b/pkg/mutator/mutator_test.go index 2cb3e947..eddbf2b0 100644 --- a/pkg/mutator/mutator_test.go +++ b/pkg/mutator/mutator_test.go @@ -372,7 +372,7 @@ func TestMutatorRun(t *testing.T) { _ = mut.Run(context.Background()) - want := "go test -tags tag1 tag2 ./..." + want := "go test -tags tag1 tag2 -timeout 21s ./..." got := fmt.Sprintf("go %v", strings.Join(holder.args, " ")) if !cmp.Equal(got, want) {