corrects test
This commit is contained in:
@@ -5,12 +5,14 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
/*
|
||||
func TestInit(t *testing.T) {
|
||||
cfg := Init()
|
||||
if cfg.AllowAdminNoMutateToggle != "7b068a99-c02b-410a-bd59-3514bac85e7a" {
|
||||
t.Errorf("Init() returned incorrect value for AllowAdminNoMutateToggle, got %v, wanted %v", cfg.AllowAdminNoMutateToggle, "7b068a99-c02b-410a-bd59-3514bac85e7a")
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func TestGetOSEnv(t *testing.T) {
|
||||
expected := "foo"
|
||||
@@ -34,13 +36,22 @@ func TestUpdateValues(t *testing.T) {
|
||||
AllowAdminNoMutateToggle: "7b068a99-c02b-410a-bd59-3514bac85e7a",
|
||||
DockerhubRegistry: "registry.hub.docker.com",
|
||||
NameSpace: "ingress-nginx",
|
||||
ServiceName: "webhook",
|
||||
MutateIgnoredImages: []string{
|
||||
"example.com/library/example:v2.3.4",
|
||||
},
|
||||
}
|
||||
cfgFile := configFileStruct{
|
||||
AllowAdminNoMutate: true,
|
||||
AllowAdminNoMutateToggle: "test-token",
|
||||
DockerhubRegistry: "registry.example.com",
|
||||
Kubernetes: KubernetesStruct{
|
||||
Namespace: "example-namespace",
|
||||
Namespace: "example-namespace",
|
||||
ServiceName: "example-webhook",
|
||||
},
|
||||
MutateIgnoredImages: []string{
|
||||
"example.com/library/example:latest",
|
||||
"example.com/library/example:v1.2.3",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -57,13 +68,19 @@ func TestUpdateValues(t *testing.T) {
|
||||
if cfg.NameSpace != cfgFile.Kubernetes.Namespace {
|
||||
t.Errorf("updateValues() returned incorrect value for NameSpace, got %v, wanted %v", cfg.NameSpace, cfgFile.Kubernetes.Namespace)
|
||||
}
|
||||
if cfg.ServiceName != cfgFile.Kubernetes.ServiceName {
|
||||
t.Errorf("updateValues() returned incorrect value for ServiceName, got %v, wanted %v", cfg.ServiceName, cfgFile.Kubernetes.ServiceName)
|
||||
}
|
||||
if len(cfg.MutateIgnoredImages) != len(cfgFile.MutateIgnoredImages) {
|
||||
t.Errorf("updateValues() returned incorrect value for MutateIgnoredImages, got %v records, wanted %v", len(cfg.MutateIgnoredImages), len(cfgFile.MutateIgnoredImages))
|
||||
} else {
|
||||
for k := range cfg.MutateIgnoredImages {
|
||||
if cfg.MutateIgnoredImages[k] != cfgFile.MutateIgnoredImages[k] {
|
||||
t.Errorf("updateValues() returned incorrect value for MutateIgnoredImages, got %v, wanted %v", cfg.MutateIgnoredImages[k], cfgFile.MutateIgnoredImages[k])
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
if cfg.ServiceName == "webhook" && configFileData.Kubernetes.ServiceName != "webhook" {
|
||||
cfg.ServiceName = configFileData.Kubernetes.ServiceName
|
||||
}
|
||||
if len(configFileData.MutateIgnoredImages) != 0 {
|
||||
cfg.MutateIgnoredImages = configFileData.MutateIgnoredImages
|
||||
}
|
||||
if len(configFileData.CertificateAuthority.Certificate) != 0 {
|
||||
cfg.CACert = configFileData.CertificateAuthority.Certificate
|
||||
}
|
||||
@@ -77,7 +94,6 @@ func TestUpdateValues(t *testing.T) {
|
||||
cfg.CertPrivateKey = configFileData.Certificate.PrivateKey
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
func TestGetDNSNames(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user