mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
code review
This commit is contained in:
@@ -38,7 +38,12 @@ metadata:
|
||||
"--user", "nobody",
|
||||
"--security-opt=no-new-privileges",
|
||||
},
|
||||
instance: Filter{Image: "example.com:version"},
|
||||
instance: Filter{
|
||||
ContainerSpec: runtimeutil.ContainerSpec{
|
||||
Image: "example.com:version",
|
||||
User: "nobody",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
@@ -56,7 +61,15 @@ metadata:
|
||||
"--user", "nobody",
|
||||
"--security-opt=no-new-privileges",
|
||||
},
|
||||
instance: Filter{Image: "example.com:version", Network: "test-1"},
|
||||
instance: Filter{
|
||||
ContainerSpec: runtimeutil.ContainerSpec{
|
||||
Image: "example.com:version",
|
||||
Network: runtimeutil.ContainerNetwork{
|
||||
Name: "test-1",
|
||||
},
|
||||
User: "nobody",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
@@ -79,12 +92,15 @@ metadata:
|
||||
"--mount", fmt.Sprintf("type=%s,source=%s,target=%s,readonly", "tmpfs", "", "/local/"),
|
||||
},
|
||||
instance: Filter{
|
||||
Image: "example.com:version",
|
||||
StorageMounts: []runtimeutil.StorageMount{
|
||||
{MountType: "bind", Src: "/mount/path", DstPath: "/local/"},
|
||||
{MountType: "bind", Src: "/mount/pathrw", DstPath: "/localrw/", ReadWriteMode: true},
|
||||
{MountType: "volume", Src: "myvol", DstPath: "/local/"},
|
||||
{MountType: "tmpfs", Src: "", DstPath: "/local/"},
|
||||
ContainerSpec: runtimeutil.ContainerSpec{
|
||||
Image: "example.com:version",
|
||||
StorageMounts: []runtimeutil.StorageMount{
|
||||
{MountType: "bind", Src: "/mount/path", DstPath: "/local/"},
|
||||
{MountType: "bind", Src: "/mount/pathrw", DstPath: "/localrw/", ReadWriteMode: true},
|
||||
{MountType: "volume", Src: "myvol", DstPath: "/local/"},
|
||||
{MountType: "tmpfs", Src: "", DstPath: "/local/"},
|
||||
},
|
||||
User: "nobody",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -104,8 +120,10 @@ metadata:
|
||||
"--security-opt=no-new-privileges",
|
||||
},
|
||||
instance: Filter{
|
||||
Image: "example.com:version",
|
||||
User: "root",
|
||||
ContainerSpec: runtimeutil.ContainerSpec{
|
||||
Image: "example.com:version",
|
||||
User: "root",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -203,7 +221,7 @@ metadata:
|
||||
}
|
||||
}
|
||||
func TestFilter_String(t *testing.T) {
|
||||
instance := Filter{Image: "foo"}
|
||||
instance := Filter{ContainerSpec: runtimeutil.ContainerSpec{Image: "foo"}}
|
||||
if !assert.Equal(t, "foo", instance.String()) {
|
||||
t.FailNow()
|
||||
}
|
||||
@@ -234,7 +252,7 @@ func TestFilter_ExitCode(t *testing.T) {
|
||||
func TestIgnoreEnv(t *testing.T) {
|
||||
os.Setenv(tmpDirEnvKey, "")
|
||||
|
||||
fltr := Filter{Image: "example.com:version"}
|
||||
fltr := Filter{ContainerSpec: runtimeutil.ContainerSpec{Image: "example.com:version"}}
|
||||
_, args := fltr.getCommand()
|
||||
for _, arg := range args {
|
||||
if arg == tmpDirEnvKey {
|
||||
|
||||
Reference in New Issue
Block a user