summaryrefslogtreecommitdiffhomepage
path: root/pkg/v1/utils/volumes_test.go
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2019-12-05 16:36:24 -0800
committerGitHub <noreply@github.com>2019-12-05 16:36:24 -0800
commite83ba107367ac3a25725d8857c2ba3cc9adbeb71 (patch)
tree1f5251266af09d1a5733b7f1ad0a806e566f47d3 /pkg/v1/utils/volumes_test.go
parent757adfa287c17d925aec7976a86986bd5b52229c (diff)
Make EmptyDir annotations compliant with K8s and OCI (#44)
Change annotation from 'gvisor.dev/spec/mount/NAME/share', which is invalid because it has more than one '/', to 'dev.gvisor.spec.mount.NAME.share'.
Diffstat (limited to 'pkg/v1/utils/volumes_test.go')
-rw-r--r--pkg/v1/utils/volumes_test.go70
1 files changed, 35 insertions, 35 deletions
diff --git a/pkg/v1/utils/volumes_test.go b/pkg/v1/utils/volumes_test.go
index 8a6a30ef1..472cd6e86 100644
--- a/pkg/v1/utils/volumes_test.go
+++ b/pkg/v1/utils/volumes_test.go
@@ -62,19 +62,19 @@ func TestUpdateVolumeAnnotations(t *testing.T) {
Annotations: map[string]string{
annotations.SandboxLogDir: testLogDirPath,
annotations.ContainerType: annotations.ContainerTypeSandbox,
- "gvisor.dev/spec/mount/" + testVolumeName + "/share": "pod",
- "gvisor.dev/spec/mount/" + testVolumeName + "/type": "tmpfs",
- "gvisor.dev/spec/mount/" + testVolumeName + "/options": "ro",
+ "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod",
+ "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs",
+ "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro",
},
},
expected: &specs.Spec{
Annotations: map[string]string{
annotations.SandboxLogDir: testLogDirPath,
annotations.ContainerType: annotations.ContainerTypeSandbox,
- "gvisor.dev/spec/mount/" + testVolumeName + "/share": "pod",
- "gvisor.dev/spec/mount/" + testVolumeName + "/type": "tmpfs",
- "gvisor.dev/spec/mount/" + testVolumeName + "/options": "ro",
- "gvisor.dev/spec/mount/" + testVolumeName + "/source": testVolumePath,
+ "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod",
+ "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs",
+ "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro",
+ "dev.gvisor.spec.mount." + testVolumeName + ".source": testVolumePath,
},
},
expectUpdate: true,
@@ -85,19 +85,19 @@ func TestUpdateVolumeAnnotations(t *testing.T) {
Annotations: map[string]string{
annotations.SandboxLogDir: testLegacyLogDirPath,
annotations.ContainerType: annotations.ContainerTypeSandbox,
- "gvisor.dev/spec/mount/" + testVolumeName + "/share": "pod",
- "gvisor.dev/spec/mount/" + testVolumeName + "/type": "tmpfs",
- "gvisor.dev/spec/mount/" + testVolumeName + "/options": "ro",
+ "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod",
+ "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs",
+ "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro",
},
},
expected: &specs.Spec{
Annotations: map[string]string{
annotations.SandboxLogDir: testLegacyLogDirPath,
annotations.ContainerType: annotations.ContainerTypeSandbox,
- "gvisor.dev/spec/mount/" + testVolumeName + "/share": "pod",
- "gvisor.dev/spec/mount/" + testVolumeName + "/type": "tmpfs",
- "gvisor.dev/spec/mount/" + testVolumeName + "/options": "ro",
- "gvisor.dev/spec/mount/" + testVolumeName + "/source": testVolumePath,
+ "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod",
+ "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs",
+ "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro",
+ "dev.gvisor.spec.mount." + testVolumeName + ".source": testVolumePath,
},
},
expectUpdate: true,
@@ -121,9 +121,9 @@ func TestUpdateVolumeAnnotations(t *testing.T) {
},
Annotations: map[string]string{
annotations.ContainerType: annotations.ContainerTypeContainer,
- "gvisor.dev/spec/mount/" + testVolumeName + "/share": "pod",
- "gvisor.dev/spec/mount/" + testVolumeName + "/type": "tmpfs",
- "gvisor.dev/spec/mount/" + testVolumeName + "/options": "ro",
+ "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod",
+ "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs",
+ "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro",
},
},
expected: &specs.Spec{
@@ -143,9 +143,9 @@ func TestUpdateVolumeAnnotations(t *testing.T) {
},
Annotations: map[string]string{
annotations.ContainerType: annotations.ContainerTypeContainer,
- "gvisor.dev/spec/mount/" + testVolumeName + "/share": "pod",
- "gvisor.dev/spec/mount/" + testVolumeName + "/type": "tmpfs",
- "gvisor.dev/spec/mount/" + testVolumeName + "/options": "ro",
+ "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod",
+ "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs",
+ "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro",
},
},
expectUpdate: true,
@@ -163,9 +163,9 @@ func TestUpdateVolumeAnnotations(t *testing.T) {
},
Annotations: map[string]string{
annotations.ContainerType: annotations.ContainerTypeContainer,
- "gvisor.dev/spec/mount/" + testVolumeName + "/share": "container",
- "gvisor.dev/spec/mount/" + testVolumeName + "/type": "bind",
- "gvisor.dev/spec/mount/" + testVolumeName + "/options": "ro",
+ "dev.gvisor.spec.mount." + testVolumeName + ".share": "container",
+ "dev.gvisor.spec.mount." + testVolumeName + ".type": "bind",
+ "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro",
},
},
expected: &specs.Spec{
@@ -179,9 +179,9 @@ func TestUpdateVolumeAnnotations(t *testing.T) {
},
Annotations: map[string]string{
annotations.ContainerType: annotations.ContainerTypeContainer,
- "gvisor.dev/spec/mount/" + testVolumeName + "/share": "container",
- "gvisor.dev/spec/mount/" + testVolumeName + "/type": "bind",
- "gvisor.dev/spec/mount/" + testVolumeName + "/options": "ro",
+ "dev.gvisor.spec.mount." + testVolumeName + ".share": "container",
+ "dev.gvisor.spec.mount." + testVolumeName + ".type": "bind",
+ "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro",
},
},
expectUpdate: true,
@@ -191,17 +191,17 @@ func TestUpdateVolumeAnnotations(t *testing.T) {
spec: &specs.Spec{
Annotations: map[string]string{
annotations.ContainerType: annotations.ContainerTypeSandbox,
- "gvisor.dev/spec/mount/" + testVolumeName + "/share": "pod",
- "gvisor.dev/spec/mount/" + testVolumeName + "/type": "tmpfs",
- "gvisor.dev/spec/mount/" + testVolumeName + "/options": "ro",
+ "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod",
+ "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs",
+ "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro",
},
},
expected: &specs.Spec{
Annotations: map[string]string{
annotations.ContainerType: annotations.ContainerTypeSandbox,
- "gvisor.dev/spec/mount/" + testVolumeName + "/share": "pod",
- "gvisor.dev/spec/mount/" + testVolumeName + "/type": "tmpfs",
- "gvisor.dev/spec/mount/" + testVolumeName + "/options": "ro",
+ "dev.gvisor.spec.mount." + testVolumeName + ".share": "pod",
+ "dev.gvisor.spec.mount." + testVolumeName + ".type": "tmpfs",
+ "dev.gvisor.spec.mount." + testVolumeName + ".options": "ro",
},
},
},
@@ -211,9 +211,9 @@ func TestUpdateVolumeAnnotations(t *testing.T) {
Annotations: map[string]string{
annotations.SandboxLogDir: testLogDirPath,
annotations.ContainerType: annotations.ContainerTypeSandbox,
- "gvisor.dev/spec/mount/notexist/share": "pod",
- "gvisor.dev/spec/mount/notexist/type": "tmpfs",
- "gvisor.dev/spec/mount/notexist/options": "ro",
+ "dev.gvisor.spec.mount.notexist.share": "pod",
+ "dev.gvisor.spec.mount.notexist.type": "tmpfs",
+ "dev.gvisor.spec.mount.notexist.options": "ro",
},
},
expectErr: true,