From 6390b653e9aefdc9e516741315d2a1aeafbed388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Salih=20=C4=B0brahimba=C5=9F?= Date: Mon, 19 Aug 2024 20:21:14 +0300 Subject: [PATCH] bug/typos-and-debug-logs: fix test typos bug/typos-and-debug-logs: remove debug logs --- pkg/bliss/httpfx/uris/common-path.go | 2 -- pkg/bliss/httpfx/uris/common-path_test.go | 2 +- pkg/bliss/logfx/fx-adapter_test.go | 2 -- pkg/bliss/logfx/handler_test.go | 1 - pkg/bliss/logfx/replacer_test.go | 4 ++-- 5 files changed, 3 insertions(+), 8 deletions(-) diff --git a/pkg/bliss/httpfx/uris/common-path.go b/pkg/bliss/httpfx/uris/common-path.go index 06b8b98..1a97e74 100644 --- a/pkg/bliss/httpfx/uris/common-path.go +++ b/pkg/bliss/httpfx/uris/common-path.go @@ -9,7 +9,6 @@ package uris import ( - "fmt" "strings" ) @@ -29,7 +28,6 @@ func CommonPath(p1, p2 *Pattern) string { writeSegment(&b, s1) } } - fmt.Println(segs1, segs2) if len(segs1) > 0 { writeMatchingPath(&b, segs1) diff --git a/pkg/bliss/httpfx/uris/common-path_test.go b/pkg/bliss/httpfx/uris/common-path_test.go index 0717530..5df83c3 100644 --- a/pkg/bliss/httpfx/uris/common-path_test.go +++ b/pkg/bliss/httpfx/uris/common-path_test.go @@ -30,7 +30,7 @@ func TestCommonPath(t *testing.T) { expected: "/bar", }, { - name: "WilcardAndMultipleSegments", + name: "WildcardAndMultipleSegments", p1: Pattern{Segments: []Segment{{wild: true, s: "foo", multi: true}}}, p2: Pattern{Segments: []Segment{{wild: false, s: "bar"}}}, expected: "/bar", diff --git a/pkg/bliss/logfx/fx-adapter_test.go b/pkg/bliss/logfx/fx-adapter_test.go index 5060f0f..4bb52bf 100644 --- a/pkg/bliss/logfx/fx-adapter_test.go +++ b/pkg/bliss/logfx/fx-adapter_test.go @@ -3,7 +3,6 @@ package logfx_test import ( "bufio" "errors" - "fmt" "log/slog" "os" "sync" @@ -156,7 +155,6 @@ func TestFxLogger_LogEvent(t *testing.T) { scanner := bufio.NewScanner(os.Stdin) for scanner.Scan() { if scanner.Text() == tt.want { - fmt.Println("Test passed") } else { t.Errorf("LogEvent() = %v, want %v", scanner.Text(), tt.want) } diff --git a/pkg/bliss/logfx/handler_test.go b/pkg/bliss/logfx/handler_test.go index be04cbe..5f2f73d 100644 --- a/pkg/bliss/logfx/handler_test.go +++ b/pkg/bliss/logfx/handler_test.go @@ -151,7 +151,6 @@ func TestHandler_Handle(t *testing.T) { PrettyMode: true, }) err := handler.Handle(context.Background(), slog.NewRecord(time.Time{}, slog.LevelInfo, "test", 0)) - fmt.Println(err) assert.EqualError(t, err, "failed to write log: failed to write") }) } diff --git a/pkg/bliss/logfx/replacer_test.go b/pkg/bliss/logfx/replacer_test.go index 5c826a4..aacf7f0 100644 --- a/pkg/bliss/logfx/replacer_test.go +++ b/pkg/bliss/logfx/replacer_test.go @@ -120,7 +120,7 @@ func TestTraceLines(t *testing.T) { return pc[:n] } - stackGeneratorWithUnkownFunctionAddr := func() []uintptr { + stackGeneratorWithUnknownFunctionAddr := func() []uintptr { var pc [32]uintptr n := runtime.Callers(0, pc[:]) pc[0] = 0 @@ -154,7 +154,7 @@ func TestTraceLines(t *testing.T) { }, { name: "Non-Empty Stack with Unknown Function Address", - stack: stackGeneratorWithUnkownFunctionAddr(), + stack: stackGeneratorWithUnknownFunctionAddr(), expected: []string{ "unknown", fmt.Sprint("github.com/eser/go-service/pkg/bliss/logfx.TestTraceLines ", pwd(), ":147"),