Skip to content

Commit

Permalink
Fixing race condition in test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy McCall (Sharon) committed Nov 9, 2017
1 parent 2550eba commit c31c5ee
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions hystrix/hystrix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,11 @@ func TestBadRequest(t *testing.T) {
So(<-resultChan, ShouldEqual, 1)

Convey("an error should have been returned", func() {
So(len(errChan), ShouldEqual, 1)
err := <-errChan
br, ok := err.(BadRequest)
So(err, ShouldNotBeNil)
_, ok := err.(BadRequest)
Convey("it should be a bad request", func() {
So(ok, ShouldBeTrue)
So(br, ShouldNotBeNil)
})
})
Convey("fallback should not have been called", func() {
Expand Down Expand Up @@ -134,12 +133,11 @@ func TestBadRequestInFallback(t *testing.T) {
So(<-resultChan, ShouldEqual, 1)

Convey("an error should have been returned", func() {
So(len(errChan), ShouldEqual, 1)
err := <-errChan
br, ok := err.(BadRequest)
So(err, ShouldNotBeNil)
_, ok := err.(BadRequest)
Convey("it should be a bad request", func() {
So(ok, ShouldBeTrue)
So(br, ShouldNotBeNil)
})
})
Convey("metrics have been recorded properly", func() {
Expand Down

0 comments on commit c31c5ee

Please sign in to comment.