diff --git a/hack/kind-bootstrap.sh b/hack/kind-bootstrap.sh index da89fc8..c396191 100755 --- a/hack/kind-bootstrap.sh +++ b/hack/kind-bootstrap.sh @@ -68,3 +68,25 @@ kind: Namespace metadata: name: empty EOF + +## 'helm' namespace +kubectl apply -f - <": { secret, + Opaque, []string{ "TEST_CONN_STR='mongodb://myDBReader:D1fficultP%40ssw0rd@mongodb0.example.com:27017/?authSource=admin'", "TEST_PASSWORD='secret\n'", @@ -133,6 +141,7 @@ func TestProcessSecret(t *testing.T) { }, "view-secret ": { secretSingle, + Opaque, []string{"secret"}, []string{fmt.Sprintf(singleKeyDescription, "SINGLE_PASSWORD")}, "", @@ -140,9 +149,29 @@ func TestProcessSecret(t *testing.T) { nil, "", }, - "view-secret test TEST_PASSWORD": {secret, []string{"secret"}, nil, "TEST_PASSWORD", false, nil, ""}, + "view-secret ": { + secretHelm, + Helm, + []string{"helm-test"}, + []string{fmt.Sprintf(singleKeyDescription, "release")}, + "", + false, + nil, + "", + }, + "view-secret test TEST_PASSWORD": { + secret, + Opaque, + []string{"secret"}, + nil, + "TEST_PASSWORD", + false, + nil, + "", + }, "view-secret test -a": { secret, + Opaque, []string{ "TEST_CONN_STR='mongodb://myDBReader:D1fficultP%40ssw0rd@mongodb0.example.com:27017/?authSource=admin'", "TEST_PASSWORD='secret\n'", @@ -154,8 +183,26 @@ func TestProcessSecret(t *testing.T) { nil, "", }, - "view-secret test NONE": {secret, nil, nil, "NONE", false, ErrSecretKeyNotFound, ""}, - "view-secret ": {secretEmpty, nil, nil, "", false, ErrSecretEmpty, ""}, + "view-secret test NONE": { + secret, + Opaque, + nil, + nil, + "NONE", + false, + ErrSecretKeyNotFound, + "", + }, + "view-secret ": { + secretEmpty, + Opaque, + nil, + nil, + "", + false, + ErrSecretEmpty, + "", + }, } for name, test := range tests { @@ -170,7 +217,7 @@ func TestProcessSecret(t *testing.T) { readBuf = *strings.NewReader(test.feedkeys) } - err := ProcessSecret(&stdOutBuf, &stdErrBuf, &readBuf, Secret{Data: test.secretData}, test.secretKey, test.decodeAll) + err := ProcessSecret(&stdOutBuf, &stdErrBuf, &readBuf, Secret{Data: test.secretData, Type: test.secretType}, test.secretKey, test.decodeAll) if test.err != nil { assert.Equal(t, err, test.err)