gocuke icon indicating copy to clipboard operation
gocuke copied to clipboard

fix issue #34

Open sith-lord-of-git opened this issue 1 year ago • 3 comments

Add stepDefs mutex and lock in appropriate places to prevent races.

Enables a test to be switched back to use the default parallel = true flag, the example api and hooks tests still fail with parallelization, but after looking it seems that's an issue with how they were written (using package global variables) rather than a bug with concurrent execution.

#34

sith-lord-of-git avatar Aug 25 '24 20:08 sith-lord-of-git

Thanks for your contribution @pauleibye ! Have you run tests with the -race flag on this branch? When I checkout this branch locally and run go test ./... -race, I'm still getting race errors.

that's a good point, no I was not. This commit did fix the race conditions in our codebase, and our test suite uses the race flag. The test that I removed the NonParallel option from might be the problem still.

edit: it looks like the race happens in simple_test.go, which might be expected given that this test uses a global that the cases all try to overwrite. image

sith-lord-of-git avatar Aug 26 '24 17:08 sith-lord-of-git

reverted simple_test.go to main, which sets the non parallel flag on the non pointer test since it relies on overwriting a shared variable in a specific order

sith-lord-of-git avatar Aug 26 '24 17:08 sith-lord-of-git

I'm still getting race errors locally. I'm going to look at this a bit and see if I can figure out what's going on.

aaronc avatar Aug 27 '24 14:08 aaronc