Skip to content

Commit

Permalink
correct compilation of handlers with stats now
Browse files Browse the repository at this point in the history
  • Loading branch information
jmhodges committed Jul 30, 2024
1 parent 07d2b2e commit d0cdd07
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"testing"
"time"

"github.com/DataDog/datadog-go/statsd"
"github.com/gorilla/mux"

"github.com/mozilla-services/autograph/database"
Expand Down Expand Up @@ -254,13 +255,14 @@ func TestLBHeartbeat(t *testing.T) {
{http.StatusMethodNotAllowed, `PUT`},
{http.StatusMethodNotAllowed, `HEAD`},
}
stats := &statsd.NoOpClient{}
for i, testcase := range TESTCASES {
req, err := http.NewRequest(testcase.method, "http://foo.bar/__lbheartbeat__", nil)
if err != nil {
t.Fatal(err)
}
w := httptest.NewRecorder()
handleLBHeartbeat(w, req)
handleLBHeartbeat(w, req, stats)
if w.Code != testcase.expect {
t.Fatalf("test case %d failed with code %d but %d was expected",
i, w.Code, testcase.expect)
Expand Down Expand Up @@ -378,13 +380,14 @@ func TestVersion(t *testing.T) {
{http.StatusMethodNotAllowed, `PUT`},
{http.StatusMethodNotAllowed, `HEAD`},
}
stats := &statsd.NoOpClient{}
for i, testcase := range TESTCASES {
req, err := http.NewRequest(testcase.method, "http://foo.bar/__version__", nil)
if err != nil {
t.Fatal(err)
}
w := httptest.NewRecorder()
handleVersion(w, req)
handleVersion(w, req, stats)
if w.Code != testcase.expect {
t.Fatalf("test case %d failed with code %d but %d was expected",
i, w.Code, testcase.expect)
Expand Down Expand Up @@ -434,6 +437,7 @@ func TestSignerAuthorized(t *testing.T) {
},
},
}

for tid, testcase := range TESTCASES {
userid := testcase.userid
body, err := json.Marshal(testcase.sgs)
Expand Down

0 comments on commit d0cdd07

Please sign in to comment.