|
|
|
@ -51,9 +51,9 @@ func TestEnvSettings(t *testing.T) {
|
|
|
|
|
ns, kcontext string
|
|
|
|
|
debug bool
|
|
|
|
|
maxhistory int
|
|
|
|
|
asUser string
|
|
|
|
|
asGroups []string
|
|
|
|
|
caFile string
|
|
|
|
|
kubeAsUser string
|
|
|
|
|
kubeAsGroups []string
|
|
|
|
|
kubeCaFile string
|
|
|
|
|
}{
|
|
|
|
|
{
|
|
|
|
|
name: "defaults",
|
|
|
|
@ -66,9 +66,9 @@ func TestEnvSettings(t *testing.T) {
|
|
|
|
|
ns: "myns",
|
|
|
|
|
debug: true,
|
|
|
|
|
maxhistory: defaultMaxHistory,
|
|
|
|
|
asUser: "poro",
|
|
|
|
|
asGroups: []string{"admins", "teatime", "snackeaters"},
|
|
|
|
|
caFile: "/tmp/ca.crt",
|
|
|
|
|
kubeAsUser: "poro",
|
|
|
|
|
kubeAsGroups: []string{"admins", "teatime", "snackeaters"},
|
|
|
|
|
kubeCaFile: "/tmp/ca.crt",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "with envvars set",
|
|
|
|
@ -76,9 +76,9 @@ func TestEnvSettings(t *testing.T) {
|
|
|
|
|
ns: "yourns",
|
|
|
|
|
maxhistory: 5,
|
|
|
|
|
debug: true,
|
|
|
|
|
asUser: "pikachu",
|
|
|
|
|
asGroups: []string{"operators", "snackeaters", "partyanimals"},
|
|
|
|
|
caFile: "/tmp/ca.crt",
|
|
|
|
|
kubeAsUser: "pikachu",
|
|
|
|
|
kubeAsGroups: []string{"operators", "snackeaters", "partyanimals"},
|
|
|
|
|
kubeCaFile: "/tmp/ca.crt",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "with flags and envvars set",
|
|
|
|
@ -87,9 +87,9 @@ func TestEnvSettings(t *testing.T) {
|
|
|
|
|
ns: "myns",
|
|
|
|
|
debug: true,
|
|
|
|
|
maxhistory: 5,
|
|
|
|
|
asUser: "poro",
|
|
|
|
|
asGroups: []string{"admins", "teatime", "snackeaters"},
|
|
|
|
|
caFile: "/my/ca.crt",
|
|
|
|
|
kubeAsUser: "poro",
|
|
|
|
|
kubeAsGroups: []string{"admins", "teatime", "snackeaters"},
|
|
|
|
|
kubeCaFile: "/my/ca.crt",
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -119,14 +119,14 @@ func TestEnvSettings(t *testing.T) {
|
|
|
|
|
if settings.MaxHistory != tt.maxhistory {
|
|
|
|
|
t.Errorf("expected maxHistory %d, got %d", tt.maxhistory, settings.MaxHistory)
|
|
|
|
|
}
|
|
|
|
|
if tt.asUser != settings.KubeAsUser {
|
|
|
|
|
t.Errorf("expected kAsUser %q, got %q", tt.asUser, settings.KubeAsUser)
|
|
|
|
|
if tt.kubeAsUser != settings.KubeAsUser {
|
|
|
|
|
t.Errorf("expected kAsUser %q, got %q", tt.kubeAsUser, settings.KubeAsUser)
|
|
|
|
|
}
|
|
|
|
|
if !reflect.DeepEqual(tt.asGroups, settings.KubeAsGroups) {
|
|
|
|
|
t.Errorf("expected kAsGroups %+v, got %+v", len(tt.asGroups), len(settings.KubeAsGroups))
|
|
|
|
|
if !reflect.DeepEqual(tt.kubeAsGroups, settings.KubeAsGroups) {
|
|
|
|
|
t.Errorf("expected kAsGroups %+v, got %+v", len(tt.kubeAsGroups), len(settings.KubeAsGroups))
|
|
|
|
|
}
|
|
|
|
|
if tt.caFile != settings.KubeCaFile {
|
|
|
|
|
t.Errorf("expected kCaFile %q, got %q", tt.caFile, settings.KubeCaFile)
|
|
|
|
|
if tt.kubeCaFile != settings.KubeCaFile {
|
|
|
|
|
t.Errorf("expected kCaFile %q, got %q", tt.kubeCaFile, settings.KubeCaFile)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|