about summary refs log tree commit diff
path: root/context/context_test.go
diff options
context:
space:
mode:
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 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)