From 6c8073b691c92dd22f2598594633c2676e397e3d Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Fri, 5 Apr 2024 00:13:42 +0800 Subject: [PATCH] chore: add more tests (#4042) --- core/stat/remotewriter_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/stat/remotewriter_test.go b/core/stat/remotewriter_test.go index e36fd800..74a14990 100644 --- a/core/stat/remotewriter_test.go +++ b/core/stat/remotewriter_test.go @@ -1,6 +1,7 @@ package stat import ( + "errors" "testing" "github.com/stretchr/testify/assert" @@ -28,3 +29,14 @@ func TestRemoteWriterFail(t *testing.T) { }) assert.NotNil(t, err) } + +func TestRemoteWriterError(t *testing.T) { + defer gock.Off() + + gock.New("http://foo.com").ReplyError(errors.New("foo")) + writer := NewRemoteWriter("http://foo.com") + err := writer.Write(&StatReport{ + Name: "bar", + }) + assert.NotNil(t, err) +}