Handle Hungarian notation issue

Issue with smallCaps combination e.g. kCaFile

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
pull/10575/head
Martin Hickey 3 years ago
parent f0fd37d2c5
commit 9975d62525

@ -51,9 +51,9 @@ func TestEnvSettings(t *testing.T) {
ns, kcontext string ns, kcontext string
debug bool debug bool
maxhistory int maxhistory int
asUser string kubeAsUser string
asGroups []string kubeAsGroups []string
caFile string kubeCaFile string
}{ }{
{ {
name: "defaults", name: "defaults",
@ -61,35 +61,35 @@ func TestEnvSettings(t *testing.T) {
maxhistory: defaultMaxHistory, maxhistory: defaultMaxHistory,
}, },
{ {
name: "with flags set", name: "with flags set",
args: "--debug --namespace=myns --kube-as-user=poro --kube-as-group=admins --kube-as-group=teatime --kube-as-group=snackeaters --kube-ca-file=/tmp/ca.crt", args: "--debug --namespace=myns --kube-as-user=poro --kube-as-group=admins --kube-as-group=teatime --kube-as-group=snackeaters --kube-ca-file=/tmp/ca.crt",
ns: "myns", ns: "myns",
debug: true, debug: true,
maxhistory: defaultMaxHistory, maxhistory: defaultMaxHistory,
asUser: "poro", kubeAsUser: "poro",
asGroups: []string{"admins", "teatime", "snackeaters"}, kubeAsGroups: []string{"admins", "teatime", "snackeaters"},
caFile: "/tmp/ca.crt", kubeCaFile: "/tmp/ca.crt",
}, },
{ {
name: "with envvars set", name: "with envvars set",
envvars: map[string]string{"HELM_DEBUG": "1", "HELM_NAMESPACE": "yourns", "HELM_KUBEASUSER": "pikachu", "HELM_KUBEASGROUPS": ",,,operators,snackeaters,partyanimals", "HELM_MAX_HISTORY": "5", "HELM_KUBECAFILE": "/tmp/ca.crt"}, envvars: map[string]string{"HELM_DEBUG": "1", "HELM_NAMESPACE": "yourns", "HELM_KUBEASUSER": "pikachu", "HELM_KUBEASGROUPS": ",,,operators,snackeaters,partyanimals", "HELM_MAX_HISTORY": "5", "HELM_KUBECAFILE": "/tmp/ca.crt"},
ns: "yourns", ns: "yourns",
maxhistory: 5, maxhistory: 5,
debug: true, debug: true,
asUser: "pikachu", kubeAsUser: "pikachu",
asGroups: []string{"operators", "snackeaters", "partyanimals"}, kubeAsGroups: []string{"operators", "snackeaters", "partyanimals"},
caFile: "/tmp/ca.crt", kubeCaFile: "/tmp/ca.crt",
}, },
{ {
name: "with flags and envvars set", name: "with flags and envvars set",
args: "--debug --namespace=myns --kube-as-user=poro --kube-as-group=admins --kube-as-group=teatime --kube-as-group=snackeaters --kube-ca-file=/my/ca.crt", args: "--debug --namespace=myns --kube-as-user=poro --kube-as-group=admins --kube-as-group=teatime --kube-as-group=snackeaters --kube-ca-file=/my/ca.crt",
envvars: map[string]string{"HELM_DEBUG": "1", "HELM_NAMESPACE": "yourns", "HELM_KUBEASUSER": "pikachu", "HELM_KUBEASGROUPS": ",,,operators,snackeaters,partyanimals", "HELM_MAX_HISTORY": "5", "HELM_KUBECAFILE": "/tmp/ca.crt"}, envvars: map[string]string{"HELM_DEBUG": "1", "HELM_NAMESPACE": "yourns", "HELM_KUBEASUSER": "pikachu", "HELM_KUBEASGROUPS": ",,,operators,snackeaters,partyanimals", "HELM_MAX_HISTORY": "5", "HELM_KUBECAFILE": "/tmp/ca.crt"},
ns: "myns", ns: "myns",
debug: true, debug: true,
maxhistory: 5, maxhistory: 5,
asUser: "poro", kubeAsUser: "poro",
asGroups: []string{"admins", "teatime", "snackeaters"}, kubeAsGroups: []string{"admins", "teatime", "snackeaters"},
caFile: "/my/ca.crt", kubeCaFile: "/my/ca.crt",
}, },
} }
@ -119,14 +119,14 @@ func TestEnvSettings(t *testing.T) {
if settings.MaxHistory != tt.maxhistory { if settings.MaxHistory != tt.maxhistory {
t.Errorf("expected maxHistory %d, got %d", tt.maxhistory, settings.MaxHistory) t.Errorf("expected maxHistory %d, got %d", tt.maxhistory, settings.MaxHistory)
} }
if tt.asUser != settings.KubeAsUser { if tt.kubeAsUser != settings.KubeAsUser {
t.Errorf("expected kAsUser %q, got %q", tt.asUser, settings.KubeAsUser) t.Errorf("expected kAsUser %q, got %q", tt.kubeAsUser, settings.KubeAsUser)
} }
if !reflect.DeepEqual(tt.asGroups, settings.KubeAsGroups) { if !reflect.DeepEqual(tt.kubeAsGroups, settings.KubeAsGroups) {
t.Errorf("expected kAsGroups %+v, got %+v", len(tt.asGroups), len(settings.KubeAsGroups)) t.Errorf("expected kAsGroups %+v, got %+v", len(tt.kubeAsGroups), len(settings.KubeAsGroups))
} }
if tt.caFile != settings.KubeCaFile { if tt.kubeCaFile != settings.KubeCaFile {
t.Errorf("expected kCaFile %q, got %q", tt.caFile, settings.KubeCaFile) t.Errorf("expected kCaFile %q, got %q", tt.kubeCaFile, settings.KubeCaFile)
} }
}) })
} }

Loading…
Cancel
Save