feat(main): Support specifying kubectl args in ResourceSets

This commit is contained in:
Martin Lehmann 2018-11-15 13:49:23 +01:00 committed by Vincent Ambo
parent 5f433c46c1
commit 54db9785d6
6 changed files with 61 additions and 2 deletions

View file

@ -54,6 +54,42 @@ func TestLoadFlatContextFromFile(t *testing.T) {
}
}
func TestLoadContextWithArgs(t *testing.T) {
ctx, err := LoadContext("testdata/flat-with-args-test.yaml", &noExplicitVars)
if err != nil {
t.Error(err)
t.Fail()
}
expected := Context{
Name: "k8s.prod.mydomain.com",
ResourceSets: []ResourceSet{
{
Name: "some-api",
Path: "some-api",
Values: make(map[string]interface{}, 0),
Args: []string{
"--as=some-user",
"--as-group=hello:world",
"--as-banana",
"true",
},
Include: nil,
Parent: "",
},
},
BaseDir: "testdata",
ImportedVars: make(map[string]interface{}, 0),
ExplicitVars: make(map[string]interface{}, 0),
}
if !reflect.DeepEqual(*ctx, expected) {
t.Error("Loaded context and expected context did not match")
t.Fail()
}
}
func TestLoadContextWithResourceSetCollections(t *testing.T) {
ctx, err := LoadContext("testdata/collections-test.yaml", &noExplicitVars)