add unittest for constants.go

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2022-04-18 17:15:04 +08:00
parent 21ab18b906
commit b895f75198
2 changed files with 42 additions and 14 deletions
+4 -2
View File
@@ -2,8 +2,10 @@ package tmpl
import (
"errors"
"github.com/golang/mock/gomock"
"gotest.tools/assert"
"github.com/stretchr/testify/assert"
"testing"
)
@@ -21,7 +23,7 @@ func Test_fetchSecretValue(t *testing.T) {
valsResult["key"] = "key_value"
c.EXPECT().Eval(expectArg).Return(valsResult, nil)
result, err := fetchSecretValue(secretPath)
assert.NilError(t, err)
assert.Nil(t, err)
assert.Equal(t, result, "key_value")
}