Skip to content

Commit

Permalink
try atomic.AddUint32() to fix data race in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Koch committed Feb 15, 2023
1 parent 4837cfe commit b0f2a68
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/http_oauth2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2195,11 +2195,11 @@ func TestTokenRequest_Runtime_Errors(t *testing.T) {
func Test_OAuth2_Introspection_Caching(t *testing.T) {
helper := test.New(t)

introspectCalled := 0
var introspectCalled uint32
active := true
asOrigin := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
if req.URL.Path == "/introspect" {
introspectCalled++
atomic.AddUint32(&introspectCalled, 1)
rw.Header().Set("Content-Type", "application/json")
rw.WriteHeader(http.StatusOK)

Expand Down Expand Up @@ -2310,11 +2310,11 @@ func Test_OAuth2_Introspection_Caching(t *testing.T) {
func Test_OAuth2_Introspection_NonCaching(t *testing.T) {
helper := test.New(t)

introspectCalled := 0
var introspectCalled uint32
active := true
asOrigin := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
if req.URL.Path == "/introspect" {
introspectCalled++
atomic.AddUint32(&introspectCalled, 1)
rw.Header().Set("Content-Type", "application/json")
rw.WriteHeader(http.StatusOK)

Expand Down

0 comments on commit b0f2a68

Please sign in to comment.