@@ -62,26 +62,26 @@ func TestGetPodVolumeMountHostSharedDir(t *testing.T) {
62
62
}{
63
63
{
64
64
name : "pod with SharedDir" ,
65
- volumes : []v1.Volume {v1. Volume {Name : "shared-dir" , VolumeSource : v1.VolumeSource {HostPath : & v1.HostPathVolumeSource {Path : "/tmp/test-annotations" }}}},
65
+ volumes : []v1.Volume {{Name : "shared-dir" , VolumeSource : v1.VolumeSource {HostPath : & v1.HostPathVolumeSource {Path : "/tmp/test-annotations" }}}},
66
66
67
67
expDir : "/tmp/test-annotations" ,
68
68
},
69
69
{
70
70
name : "pod with SharedDir 2" ,
71
- volumes : []v1.Volume {v1. Volume {Name : "some-dir" }, v1. Volume {Name : "shared-dir" , VolumeSource : v1.VolumeSource {HostPath : & v1.HostPathVolumeSource {Path : "/tmp/test-annotations" }}}},
71
+ volumes : []v1.Volume {{Name : "some-dir" }, {Name : "shared-dir" , VolumeSource : v1.VolumeSource {HostPath : & v1.HostPathVolumeSource {Path : "/tmp/test-annotations" }}}},
72
72
73
73
expDir : "/tmp/test-annotations" ,
74
74
},
75
75
{
76
76
name : "pod with SharedDir 3" ,
77
- volumes : []v1.Volume {v1. Volume {Name : "shared-dir" , VolumeSource : v1.VolumeSource {HostPath : & v1.HostPathVolumeSource {Path : "/tmp/test-annotations/volumes" }}}},
78
- containers : []v1.Container {v1. Container {Name : "container" , VolumeMounts : []v1.VolumeMount {{Name : "shared-dir" , MountPath : "/tmp/test-annotations/containers" }}}},
77
+ volumes : []v1.Volume {{Name : "shared-dir" , VolumeSource : v1.VolumeSource {HostPath : & v1.HostPathVolumeSource {Path : "/tmp/test-annotations/volumes" }}}},
78
+ containers : []v1.Container {{Name : "container" , VolumeMounts : []v1.VolumeMount {{Name : "shared-dir" , MountPath : "/tmp/test-annotations/containers" }}}},
79
79
80
80
expDir : "/tmp/test-annotations/volumes" ,
81
81
},
82
82
{
83
83
name : "pod with EmptyDir" ,
84
- volumes : []v1.Volume {v1. Volume {Name : "shared-dir" , VolumeSource : v1.VolumeSource {EmptyDir : & v1.EmptyDirVolumeSource {}}}},
84
+ volumes : []v1.Volume {{Name : "shared-dir" , VolumeSource : v1.VolumeSource {EmptyDir : & v1.EmptyDirVolumeSource {}}}},
85
85
86
86
expDir : "/var/lib/kubelet/pods/#UUID#/volumes/kubernetes.io~empty-dir/shared-dir" ,
87
87
},
@@ -96,12 +96,12 @@ func TestGetPodVolumeMountHostSharedDir(t *testing.T) {
96
96
},
97
97
{
98
98
name : "fail with pod without shareddir volumes" ,
99
- volumes : []v1.Volume {v1. Volume {Name : "shared_dir" }, v1. Volume {Name : "shareddir" }},
99
+ volumes : []v1.Volume {{Name : "shared_dir" }, {Name : "shareddir" }},
100
100
expErr : errors .New ("Error: No shared-dir. Need \" shared-dir\" in podSpec \" Volumes\" " ),
101
101
},
102
102
{
103
103
name : "fail with pod without shareddir HostPath" ,
104
- volumes : []v1.Volume {v1. Volume {Name : "shared-dir" , VolumeSource : v1.VolumeSource {}}},
104
+ volumes : []v1.Volume {{Name : "shared-dir" , VolumeSource : v1.VolumeSource {}}},
105
105
expErr : errors .New ("Error: Volume is invalid" ),
106
106
},
107
107
}
@@ -141,26 +141,26 @@ func TestGetPodVolumeMountHostMappedSharedDir(t *testing.T) {
141
141
}{
142
142
{
143
143
name : "pod with SharedDir" ,
144
- containers : []v1.Container {v1. Container {Name : "container" , VolumeMounts : []v1.VolumeMount {{Name : "shared-dir" , MountPath : "/tmp/test-annotations" }}}},
144
+ containers : []v1.Container {{Name : "container" , VolumeMounts : []v1.VolumeMount {{Name : "shared-dir" , MountPath : "/tmp/test-annotations" }}}},
145
145
146
146
expDir : "/tmp/test-annotations" ,
147
147
},
148
148
{
149
149
name : "pod with SharedDir 2" ,
150
- containers : []v1.Container {v1. Container {Name : "init-container" }, v1. Container {Name : "container" , VolumeMounts : []v1.VolumeMount {{Name : "some-dir" }, {Name : "shared-dir" , MountPath : "/tmp/test-annotations" }}}},
150
+ containers : []v1.Container {{Name : "init-container" }, {Name : "container" , VolumeMounts : []v1.VolumeMount {{Name : "some-dir" }, {Name : "shared-dir" , MountPath : "/tmp/test-annotations" }}}},
151
151
152
152
expDir : "/tmp/test-annotations" ,
153
153
},
154
154
{
155
155
name : "pod with SharedDir 3" ,
156
- volumes : []v1.Volume {v1. Volume {Name : "shared-dir" , VolumeSource : v1.VolumeSource {HostPath : & v1.HostPathVolumeSource {Path : "/tmp/test-annotations/volumes" }}}},
157
- containers : []v1.Container {v1. Container {Name : "container" , VolumeMounts : []v1.VolumeMount {{Name : "shared-dir" , MountPath : "/tmp/test-annotations/containers" }}}},
156
+ volumes : []v1.Volume {{Name : "shared-dir" , VolumeSource : v1.VolumeSource {HostPath : & v1.HostPathVolumeSource {Path : "/tmp/test-annotations/volumes" }}}},
157
+ containers : []v1.Container {{Name : "container" , VolumeMounts : []v1.VolumeMount {{Name : "shared-dir" , MountPath : "/tmp/test-annotations/containers" }}}},
158
158
159
159
expDir : "/tmp/test-annotations/containers" ,
160
160
},
161
161
{
162
162
name : "fail with empty SharedDir" ,
163
- containers : []v1.Container {v1. Container {Name : "container" , VolumeMounts : []v1.VolumeMount {{Name : "shared-dir" , MountPath : "" }}}},
163
+ containers : []v1.Container {{Name : "container" , VolumeMounts : []v1.VolumeMount {{Name : "shared-dir" , MountPath : "" }}}},
164
164
expErr : errors .New ("Error: No mapped shared-dir." ),
165
165
},
166
166
{
@@ -174,7 +174,7 @@ func TestGetPodVolumeMountHostMappedSharedDir(t *testing.T) {
174
174
},
175
175
{
176
176
name : "fail with pod without shareddir containers" ,
177
- containers : []v1.Container {v1. Container {Name : "container1" , VolumeMounts : []v1.VolumeMount {{Name : "shareddir" }, {Name : "shared_dir" }}}, v1. Container {Name : "container2" , VolumeMounts : []v1.VolumeMount {{Name : "some-dir" }, {Name : "empty-dir" }}}},
177
+ containers : []v1.Container {{Name : "container1" , VolumeMounts : []v1.VolumeMount {{Name : "shareddir" }, {Name : "shared_dir" }}}, {Name : "container2" , VolumeMounts : []v1.VolumeMount {{Name : "some-dir" }, {Name : "empty-dir" }}}},
178
178
expErr : errors .New ("Error: No mapped shared-dir. Need \" shared-dir\" in podSpec \" Volumes\" " ),
179
179
},
180
180
}
@@ -641,7 +641,7 @@ func TestGetFileAnnotationConfigData(t *testing.T) {
641
641
{
642
642
name : "get configuration data from annotations" ,
643
643
annot : `userspace/configuration-data="[{\"Name\":\"Container New Name\",\"ContainerId\":\"123-456-789-007\"}]"` ,
644
- expResult : []* types.ConfigurationData {& types. ConfigurationData {Name : "Container New Name" , ContainerId : "123-456-789-007" }},
644
+ expResult : []* types.ConfigurationData {{Name : "Container New Name" , ContainerId : "123-456-789-007" }},
645
645
},
646
646
{
647
647
name : "fail to get configuration data" ,
0 commit comments