-
-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running make testrace
fails with race detected during execution of test
#89
Comments
The mock server it starts is stateful, as it needs to confirm the the expected interactions for each test are actually made, so running the pact tests in parallel is not possible, unless you create multiple instances of the pact struct on different ports. See https://github.com/pact-foundation/pact-go/blob/master/README.md#splitting-tests-across-multiple-files for some insight into how you might be able to achieve it |
Sorry, didn't mean to hit close. Will look into it and add some documentation for others |
Probably a basic question, but even if I just run a single pact test, it still fails with race condition. Or do you mean something different? |
Updated description above to include repro steps for issue when running single consumer pact test from |
That's fantastic, thanks! It should be possible to run the test, so looks like a bug we can hunt down. |
Fix is now in master, but not in a tagged release. If you'd like to give this a go in your project @rasmus-unity that'd be great. |
@mefellows, verified it works on our test suite also. thanks for the quick fix to this! |
Your welcome, thanks! |
We're running our unit tests with
-race
option, and when trying to introduce pact consumer tests, they fail with a race condition. Reproduced on latest master from https://github.com/pact-foundation/pact-go repo. We can probably find a way to run pact tests without race detection, but curious to know if this is an issue which should be fixed.Software versions
master
branch)go version go1.9.4 darwin/amd64
Expected behaviour
Running pact tests with
-race
should passActual behaviour
Fails with
Steps to reproduce
git clone [email protected]:pact-foundation/pact-go.git
cd pact-go
make testrace
EDIT: Alternatively
git clone [email protected]:pact-foundation/pact-go.git
cd pact-go/examples/consumer/goconsumer
go test -race -run TestPactConsumerLoginHandler_UserExists .
Result:
Found 2 data race(s)
Relevent log files
Hope above is sufficient
The text was updated successfully, but these errors were encountered: