mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
Support mounting volumes to containers
This commit is contained in:
@@ -27,6 +27,7 @@ func TestRunFnCommand_preRunE(t *testing.T) {
|
||||
functionPaths []string
|
||||
network bool
|
||||
networkName string
|
||||
volumes []string
|
||||
}{
|
||||
{
|
||||
name: "config map",
|
||||
@@ -213,6 +214,29 @@ metadata:
|
||||
data: {g: h, i: j=k}
|
||||
kind: Foo
|
||||
apiVersion: v1
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "volumes",
|
||||
args: []string{"run", "dir", "--volume", "vol1", "--volume", "vol2"},
|
||||
path: "dir",
|
||||
volumes: []string{"vol1", "vol2"},
|
||||
},
|
||||
{
|
||||
name: "custom kind with volumes",
|
||||
args: []string{
|
||||
"run", "dir", "--volume", "vol", "--image", "foo:bar", "--", "Foo", "g=h", "i=j=k"},
|
||||
path: "dir",
|
||||
volumes: []string{"vol"},
|
||||
expected: `
|
||||
metadata:
|
||||
name: function-input
|
||||
annotations:
|
||||
config.kubernetes.io/function: |
|
||||
container: {image: 'foo:bar'}
|
||||
data: {g: h, i: j=k}
|
||||
kind: Foo
|
||||
apiVersion: v1
|
||||
`,
|
||||
},
|
||||
{
|
||||
@@ -303,6 +327,15 @@ apiVersion: v1
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
// check if Volumes were set
|
||||
if tt.volumes == nil {
|
||||
// make Equal work against flag default
|
||||
tt.volumes = []string{}
|
||||
}
|
||||
if !assert.Equal(t, tt.volumes, r.RunFns.Volumes) {
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
// check if Functions were set
|
||||
if tt.expected != "" {
|
||||
if !assert.Len(t, r.RunFns.Functions, 1) {
|
||||
|
||||
Reference in New Issue
Block a user