Skip to content

Commit

Permalink
Use atomic to adjust counter in termination test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelSpeed committed Jul 29, 2020
1 parent d6e676f commit e463604
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/termination/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ var _ = Describe("Handler Suite", func() {
Context("and the instance termination endpoint returns an unknown status", func() {
BeforeEach(func() {
httpHandler = newMockHTTPHandler(func(rw http.ResponseWriter, req *http.Request) {
if counter == 4 {
if atomic.LoadInt32(&counter) == 4 {
rw.WriteHeader(500)
} else {
counter++
atomic.AddInt32(&counter, 1)
rw.WriteHeader(404)
}
})
Expand Down

0 comments on commit e463604

Please sign in to comment.