add --fn-user flag to function run

This commit is contained in:
Donny Xia
2020-08-18 12:49:10 -07:00
parent 30b58e90a3
commit 646e0b4f61
2 changed files with 26 additions and 0 deletions

View File

@@ -203,6 +203,7 @@ apiVersion: v1
Path: "dir",
NetworkName: "bridge",
EnableStarlark: true,
User: "nobody",
},
},
{
@@ -256,6 +257,7 @@ apiVersion: v1
Path: "dir",
NetworkName: "bridge",
ResultsDir: "foo/",
User: "nobody",
},
expected: `
metadata:
@@ -283,6 +285,26 @@ apiVersion: v1
args: []string{"run", "dir", "--image", "foo:bar", "--", "a=b", "c", "e=f"},
err: "must have keys and values separated by",
},
{
name: "specify username",
args: []string{"run", "dir", "--fn-user", "root", "--image", "foo:bar"},
path: "dir",
expectedStruct: &runfn.RunFns{
Path: "dir",
NetworkName: "bridge",
User: "root",
},
expected: `
metadata:
name: function-input
annotations:
config.kubernetes.io/function: |
container: {image: 'foo:bar'}
data: {}
kind: ConfigMap
apiVersion: v1
`,
},
}
for i := range tests {