@ -51,9 +51,9 @@ func TestEnvSettings(t *testing.T) {
ns , kcontext string
ns , kcontext string
debug bool
debug bool
maxhistory int
maxhistory int
kAsUser string
asUser string
kAsGroups [ ] string
asGroups [ ] string
kCaFile string
caFile string
} {
} {
{
{
name : "defaults" ,
name : "defaults" ,
@ -66,9 +66,9 @@ func TestEnvSettings(t *testing.T) {
ns : "myns" ,
ns : "myns" ,
debug : true ,
debug : true ,
maxhistory : defaultMaxHistory ,
maxhistory : defaultMaxHistory ,
kAsUser: "poro" ,
asUser: "poro" ,
kAsGroups: [ ] string { "admins" , "teatime" , "snackeaters" } ,
asGroups: [ ] string { "admins" , "teatime" , "snackeaters" } ,
kCaFile: "/tmp/ca.crt" ,
caFile: "/tmp/ca.crt" ,
} ,
} ,
{
{
name : "with envvars set" ,
name : "with envvars set" ,
@ -76,9 +76,9 @@ func TestEnvSettings(t *testing.T) {
ns : "yourns" ,
ns : "yourns" ,
maxhistory : 5 ,
maxhistory : 5 ,
debug : true ,
debug : true ,
kAsUser: "pikachu" ,
asUser: "pikachu" ,
kAsGroups: [ ] string { "operators" , "snackeaters" , "partyanimals" } ,
asGroups: [ ] string { "operators" , "snackeaters" , "partyanimals" } ,
kCaFile: "/tmp/ca.crt" ,
caFile: "/tmp/ca.crt" ,
} ,
} ,
{
{
name : "with flags and envvars set" ,
name : "with flags and envvars set" ,
@ -87,9 +87,9 @@ func TestEnvSettings(t *testing.T) {
ns : "myns" ,
ns : "myns" ,
debug : true ,
debug : true ,
maxhistory : 5 ,
maxhistory : 5 ,
kAsUser: "poro" ,
asUser: "poro" ,
kAsGroups: [ ] string { "admins" , "teatime" , "snackeaters" } ,
asGroups: [ ] string { "admins" , "teatime" , "snackeaters" } ,
kCaFile: "/my/ca.crt" ,
caFile: "/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 . kA sUser != settings . KubeAsUser {
if tt . a sUser != settings . KubeAsUser {
t . Errorf ( "expected kAsUser %q, got %q" , tt . kA sUser, settings . KubeAsUser )
t . Errorf ( "expected kAsUser %q, got %q" , tt . a sUser, settings . KubeAsUser )
}
}
if ! reflect . DeepEqual ( tt . kA sGroups, settings . KubeAsGroups ) {
if ! reflect . DeepEqual ( tt . a sGroups, settings . KubeAsGroups ) {
t . Errorf ( "expected kAsGroups %+v, got %+v" , len ( tt . kA sGroups) , len ( settings . KubeAsGroups ) )
t . Errorf ( "expected kAsGroups %+v, got %+v" , len ( tt . a sGroups) , len ( settings . KubeAsGroups ) )
}
}
if tt . kC aFile != settings . KubeCaFile {
if tt . c aFile != settings . KubeCaFile {
t . Errorf ( "expected kCaFile %q, got %q" , tt . kC aFile, settings . KubeCaFile )
t . Errorf ( "expected kCaFile %q, got %q" , tt . c aFile, settings . KubeCaFile )
}
}
} )
} )
}
}