coder / hat

HTTP API testing for Go
MIT License
37 stars 3 forks source link

this library will not work for parallel tests #14

Closed nhooyr closed 4 years ago

nhooyr commented 6 years ago

This is due to the use of t.Fatal, that method cannot be called from another goroutine that is not the original testing goroutine.

We will need to rethink the API for parallel tests.

ammario commented 6 years ago

Could you elaborate on why it couldn't be used in t.Parallel?

The only usage of t.Fatal occurs in DuplicateBody, which would be called from the goroutine that created the t.

nhooyr commented 6 years ago

My bad, I was not clear enough. By parallel tests, I mean sending multiple requests at once in parallel in a co-ordinated fashion against an API to test for race conditions etc. Not a separate parallel test.

ammario commented 6 years ago

Interesting. We could add a method to get an underlying http.Request from a hat.Request, but that still couldn't use Response assertion.

nhooyr commented 4 years ago

Going to close as it has been a long time and I'm not sure if this is relevant anymore.