about summary refs log tree commit diff
path: root/context/context_test.go
diff options
context:
space:
mode:
authorMartin Lehmann <martin@folio.no>2018-11-15T12·49+0100
committerVincent Ambo <github@tazj.in>2018-12-11T09·58+0100
commit54db9785d65d8a9dfc78d1cf230810b19f1abffb (patch)
treefcbfd470aaf794ca21bcd2a5ccc1a9dac66a3c12 /context/context_test.go
parent5f433c46c16f4466ad17578eb1762399aa7746d1 (diff)
feat(main): Support specifying kubectl args in ResourceSets
Diffstat (limited to 'context/context_test.go')
-rw-r--r--context/context_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/context/context_test.go b/context/context_test.go
index 34c77cc9b7..d7fdc11e57 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)