From c1475dd71cdffe7ccf9a0f879e8b21c4058580c1 Mon Sep 17 00:00:00 2001 From: mkelvers Date: Fri, 26 Jun 2026 23:45:47 +0200 Subject: [PATCH] test: assert pprof routes return 404 --- internal/server/server_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/server/server_test.go b/internal/server/server_test.go index a4b08b56..97cbc608 100644 --- a/internal/server/server_test.go +++ b/internal/server/server_test.go @@ -36,7 +36,7 @@ func TestNewHTTPServer_TimeoutsAndAddr(t *testing.T) { } } -func TestProvideRouterRegistersPprof(t *testing.T) { +func TestProvideRouterDoesNotRegisterPprof(t *testing.T) { gin.SetMode(gin.TestMode) router := ProvideRouter(config.Config{GinMode: gin.TestMode}, nil) @@ -45,11 +45,11 @@ func TestProvideRouterRegistersPprof(t *testing.T) { router.ServeHTTP(rec, req) - if rec.Code != http.StatusOK { - t.Fatalf("pprof status = %d, want %d", rec.Code, http.StatusOK) + if rec.Code != http.StatusNotFound { + t.Fatalf("pprof status = %d, want %d", rec.Code, http.StatusNotFound) } - if !strings.Contains(rec.Body.String(), "Types of profiles available") { - t.Fatalf("pprof index missing profile list: %s", rec.Body.String()) + if strings.Contains(rec.Body.String(), "Types of profiles available") { + t.Fatalf("pprof index should not be exposed: %s", rec.Body.String()) } }