Be Careful with Table Driven Tests and t.Parallel()

157 views
Skip to first unread message

Eyal Posener

unread,
Jan 13, 2018, 3:07:38 AM1/13/18
to golang-nuts
Hi,

A small talk about table driven tests and t.Parallel - it is dangerous!

https://gist.github.com/posener/92a55c4cd441fc5e5e85f27bca008721

Axel Wagner

unread,
Jan 13, 2018, 3:20:43 AM1/13/18
to Eyal Posener, golang-nuts
There is #20733 which is about the necessary language change (which has to wait for Go 2, though).

I'm not sure a vet-check can reasonably catch this, particular case; you'd have to at least special case for (*testing.T).Parallel calls, as it's not apparent from the code itself, that there will be a goroutine spawned.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages