I have a Go project that uses modules. The module contains many packages, which are nested.
When I let Go figure out the package structure by passing ./...
to go test
it runs the tests in parallel (the default behaviour).
Testing a single package with the -failfast
flag works, it stops at the first failure, however what I'd like to achieve is to use -failfast
across all the packages combined (for increased CI/CD throughput). When the first test in one of the packages that are tested in parallel by a single go test ./...
invocation fails, I'd like to stop the whole test suite.
Is this even possible with the current version of the go testing utility? If not, is there perhaps a plan to implement such thing in the future?
I did not find a solution that would enable me to do this in parallel yet, however one thing that I thought of is to combine something like go test -failfast
, go list ./...
and xargs
and run tests in a sequence (not parallely). I'd check the output of the last tested package and stop everything on first failure. This doesn't sound that good though and will probably be quite a bit slower.
So yeah, are there any existing solutions or approaches that I haven't found/thought of?
Thanks!
go version go1.12 darwin/amd64
Aucun commentaire:
Enregistrer un commentaire