From 961f300c144669d5c0985008ca3b7c05cd46dd05 Mon Sep 17 00:00:00 2001 From: Ming Deng Date: Sun, 20 Sep 2020 13:15:38 +0800 Subject: [PATCH] Fix JL tests --- pkg/infrastructure/logs/formatter_test.go | 2 +- pkg/infrastructure/logs/jianliao_test.go | 29 ----------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/pkg/infrastructure/logs/formatter_test.go b/pkg/infrastructure/logs/formatter_test.go index 7ba9237b..a97765ac 100644 --- a/pkg/infrastructure/logs/formatter_test.go +++ b/pkg/infrastructure/logs/formatter_test.go @@ -92,4 +92,4 @@ func TestPatternLogFormatter(t *testing.T) { if got != want { t.Errorf("want %s, got %s", want, got) } -} \ No newline at end of file +} diff --git a/pkg/infrastructure/logs/jianliao_test.go b/pkg/infrastructure/logs/jianliao_test.go index eb0ac9e1..a1b2d076 100644 --- a/pkg/infrastructure/logs/jianliao_test.go +++ b/pkg/infrastructure/logs/jianliao_test.go @@ -15,41 +15,12 @@ package logs import ( - "net/http" "testing" "time" "github.com/stretchr/testify/assert" ) -type TestHttpHandler struct { -} - -func (t *TestHttpHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) { - writer.Write([]byte("coming")) -} - -func TestJLWriter_WriteMsg(t *testing.T) { - // start sever - - http.Handle("/", &TestHttpHandler{}) - go http.ListenAndServe(":12124", nil) - - jl := newJLWriter() - jl.Init(`{ -"webhookurl":"http://localhost:12124/hello", -"redirecturl":"nil", -"imageurl":"a" -}`) - err := jl.WriteMsg(&LogMsg{ - Msg: "world", - }) - - jl.Flush() - jl.Destroy() - assert.Nil(t, err) -} - func TestJLWriter_Format(t *testing.T) { lg := &LogMsg{ Level: LevelDebug,