paralleltest icon indicating copy to clipboard operation
paralleltest copied to clipboard

Is there a way to ignore an specific test function/file?

Open Esequiel378 opened this issue 1 year ago • 4 comments

I'm using the gock library to test my HTTP request, but it doesn't play well with concurrency, so I need those tests to not run in parallel. Is there a way for me to ignore those tests without disabling the rule?

Esequiel378 avatar Jun 02 '23 20:06 Esequiel378

I am unsure of what your set-up is, but can't you avoid running your tests in parallel by doing go test -p 1 ./...

kunwardeep avatar Jun 05 '23 00:06 kunwardeep

Running the test in parallel speeds up the process, so if I run the test with the -p 1, it defeats the whole point of using the t.Parallel(). For now, I've removed the t.Parallel() line for the test that uses the gock library

Esequiel378 avatar Aug 26 '23 14:08 Esequiel378

I am not sure of the test setup, but we do have two flags to ignore the tests. Would they work?

A few options can be activated by flag:

-i: Ignore missing calls to t.Parallel and only report incorrect uses of it.
-ignoremissingsubtests: Require that top-level tests specify t.Parallel, but don't require it in subtests (t.Run(...)).```

kunwardeep avatar Aug 28 '23 04:08 kunwardeep