From 1ffd7f640b2be80459c426f18c7d1dc3668e6399 Mon Sep 17 00:00:00 2001 From: Raul del Aguila <38803643+raulaguila@users.noreply.github.com> Date: Tue, 29 Aug 2023 20:39:14 -0400 Subject: [PATCH] created test to verify ip tag size. --- middleware/logger/logger_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/middleware/logger/logger_test.go b/middleware/logger/logger_test.go index d563a5ccc6..0fa31a35e7 100644 --- a/middleware/logger/logger_test.go +++ b/middleware/logger/logger_test.go @@ -231,6 +231,25 @@ func getLatencyTimeUnits() []struct { } } +// go test -run Test_Logger_LenTagIP +func Test_Logger_LenTagIP(t *testing.T) { + t.Parallel() + buf := bytebufferpool.Get() + defer bytebufferpool.Put(buf) + + app := fiber.New() + app.Use(New(Config{ + Format: "${ip}", + Output: buf, + })) + + resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", nil)) + utils.AssertEqual(t, nil, err) + utils.AssertEqual(t, fiber.StatusNotFound, resp.StatusCode) + + utils.AssertEqual(t, 15, len(buf.String())) +} + // go test -run Test_Logger_WithLatency func Test_Logger_WithLatency(t *testing.T) { t.Parallel()