From 54db9785d65d8a9dfc78d1cf230810b19f1abffb Mon Sep 17 00:00:00 2001 From: Martin Lehmann Date: Thu, 15 Nov 2018 13:49:23 +0100 Subject: feat(main): Support specifying kubectl args in ResourceSets --- context/context_test.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'context/context_test.go') diff --git a/context/context_test.go b/context/context_test.go index 34c77cc9b7c6..d7fdc11e5718 100644 --- a/context/context_test.go +++ b/context/context_test.go @@ -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) -- cgit 1.4.1