E2e test for run with json

This commit is contained in:
Phani Teja Marupaka
2020-06-08 20:51:01 -07:00
parent b39c522cc1
commit e994b3b566
9 changed files with 76 additions and 122 deletions

View File

@@ -30,6 +30,7 @@ func TestRunE2e(t *testing.T) {
expectedErr string
skipIfFalseEnv string
}{
{
name: "exec_function_no_args",
args: func(d string) []string {
@@ -63,6 +64,46 @@ metadata:
},
},
{
name: "exec_function_no_args_json",
args: func(d string) []string {
return []string{
"--enable-exec", "--exec-path", filepath.Join(d, "e2econtainerconfig"),
}
},
files: func(d string) map[string]string {
return map[string]string{
"deployment.json": `
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "foo"
}
}
`,
}
},
expectedFiles: func(d string) map[string]string {
return map[string]string{
"deployment.json": `
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"annotations": {
"a-bool-value": "false",
"a-int-value": "0",
"a-string-value": ""
},
"name": "foo"
}
}
`,
}
},
},
{
name: "exec_function_args",
args: func(d string) []string {
@@ -468,7 +509,6 @@ def run(r, fc):
resource["metadata"]["annotations"]["a-string-value"] = fc["data"]["stringValue"]
resource["metadata"]["annotations"]["a-int-value"] = fc["data"]["intValue"]
resource["metadata"]["annotations"]["a-bool-value"] = fc["data"]["boolValue"]
run(ctx.resource_list["items"], ctx.resource_list["functionConfig"])
`,
"config.yaml": `
@@ -545,7 +585,6 @@ def run(r, fc):
resource["metadata"]["annotations"]["a-string-value"] = fc["data"]["stringValue"]
resource["metadata"]["annotations"]["a-int-value"] = fc["data"]["intValue"]
resource["metadata"]["annotations"]["a-bool-value"] = fc["data"]["boolValue"]
run(ctx.resource_list["items"], ctx.resource_list["functionConfig"])
`,
"deployment.yaml": `