From d0cdd07d10321726afb02b706973039bace273a5 Mon Sep 17 00:00:00 2001 From: Jeff Hodges Date: Tue, 30 Jul 2024 12:36:18 -0700 Subject: [PATCH] correct compilation of handlers with stats now --- handlers_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/handlers_test.go b/handlers_test.go index 1d5d4bca2..c7aa39b3d 100644 --- a/handlers_test.go +++ b/handlers_test.go @@ -24,6 +24,7 @@ import ( "testing" "time" + "github.com/DataDog/datadog-go/statsd" "github.com/gorilla/mux" "github.com/mozilla-services/autograph/database" @@ -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) @@ -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) @@ -434,6 +437,7 @@ func TestSignerAuthorized(t *testing.T) { }, }, } + for tid, testcase := range TESTCASES { userid := testcase.userid body, err := json.Marshal(testcase.sgs)