From 606cfdec138ea68fbd0a704b797749a22823c0ee Mon Sep 17 00:00:00 2001 From: Yonghwan SO Date: Sun, 24 Apr 2022 02:20:40 +0900 Subject: [PATCH] some more tests --- internal/common/context_test.go | 14 ++++++++++++++ internal/common/plugins_test.go | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/internal/common/context_test.go b/internal/common/context_test.go index d4892ab..be29acc 100644 --- a/internal/common/context_test.go +++ b/internal/common/context_test.go @@ -38,6 +38,20 @@ func TestContextCancel(t *testing.T) { r.NotNil(c.Err()) } +func TestContextDoubleCancel(t *testing.T) { + r := require.New(t) + + opt := Options{LogLevel: "info"} + c, ccf := NewDefaultContext(&opt) + r.NotNil(c) + r.NotNil(ccf) + + r.Nil(c.Err()) + c.Cancel() + r.NotNil(c.Err()) + c.Cancel() +} + func TestContextWG(t *testing.T) { r := require.New(t) diff --git a/internal/common/plugins_test.go b/internal/common/plugins_test.go index 2a4a6f4..cf5e63f 100644 --- a/internal/common/plugins_test.go +++ b/internal/common/plugins_test.go @@ -70,6 +70,11 @@ func TestBuildPluginOptions(t *testing.T) { out: nil, e: fmt.Errorf("%w: heartbeat", ErrInvalidePluginOption), }, + { + in: "", + out: map[string]PluginOptions{}, + e: nil, + }, } for _, tc := range tests {