Adding test for new function
This commit is contained in:
parent
cef2e6f5e2
commit
fedcffee9d
1 changed files with 21 additions and 0 deletions
|
@ -18,6 +18,7 @@ package store
|
|||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"testing"
|
||||
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -127,6 +128,26 @@ func buildCrtKeyAndCA() ([]byte, []byte, []byte, error) {
|
|||
return dCrt, dKey, dCa, nil
|
||||
}
|
||||
|
||||
func TestGetSecretKey(t *testing.T) {
|
||||
secretName := "secretNamespace/superSecret"
|
||||
ingressNamespace := "ingressNamespace"
|
||||
|
||||
// Test when secret is in not in the same namespace as ingress.
|
||||
|
||||
secretKey := getSecretKey(ingressNamespace, secretName)
|
||||
if secretKey != "secretNamespace/superSecret" {
|
||||
t.Errorf("expected 0 items in the store but %v returned", secretKey)
|
||||
}
|
||||
|
||||
// Test when secret resides in the same namespace as ingress.
|
||||
secretName = "superSecret"
|
||||
|
||||
secretKey = getSecretKey(ingressNamespace, secretName)
|
||||
if secretKey != "ingressNamespace/superSecret" {
|
||||
t.Errorf("expected 0 items in the store but %v returned", secretKey)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func TestSyncSecret(t *testing.T) {
|
||||
// prepare for test
|
||||
|
|
Loading…
Reference in a new issue