@@ -143,56 +143,42 @@ func Test_fsGroupForMetadata(t *testing.T) {
143143 }
144144
145145 tests := map [string ]struct {
146- fixedFSGroup * int64
147146 metaVolumeMountGroup string
148147 fsGroupVolumeAttributeKey string
149148 volumeContext map [string ]string
150149
151150 expGID * int64
152151 expErr bool
153152 }{
154- "FixedFSGroup=nil meta.VolumeMountGroup='' FSGroupVolumeAttributeKey='', should return nil gid" : {
155- fixedFSGroup : nil ,
153+ "meta.VolumeMountGroup='' FSGroupVolumeAttributeKey='', should return nil gid" : {
156154 metaVolumeMountGroup : "" ,
157155 fsGroupVolumeAttributeKey : "" ,
158156 volumeContext : map [string ]string {},
159157 expGID : nil ,
160158 expErr : false ,
161159 },
162- "FixedFSGroup=10 meta.VolumeMountGroup='' FSGroupVolumeAttributeKey='', should return 10" : {
163- fixedFSGroup : intPtr (10 ),
164- metaVolumeMountGroup : "" ,
165- fsGroupVolumeAttributeKey : "" ,
166- volumeContext : map [string ]string {},
167- expGID : intPtr (10 ),
168- expErr : false ,
169- },
170- "FixedFSGroup=nil meta.VolumeMountGroup='70' FSGroupVolumeAttributeKey='', should return 70" : {
171- fixedFSGroup : nil ,
160+ "meta.VolumeMountGroup='70' FSGroupVolumeAttributeKey='', should return 70" : {
172161 metaVolumeMountGroup : "70" ,
173162 fsGroupVolumeAttributeKey : "" ,
174163 volumeContext : map [string ]string {},
175164 expGID : intPtr (70 ),
176165 expErr : false ,
177166 },
178- "FixedFSGroup=nil meta.VolumeMountGroup='' FSGroupVolumeAttributeKey=defined but not present in context, should return nil" : {
179- fixedFSGroup : nil ,
167+ "meta.VolumeMountGroup='' FSGroupVolumeAttributeKey=defined but not present in context, should return nil" : {
180168 metaVolumeMountGroup : "" ,
181169 fsGroupVolumeAttributeKey : "fs-gid" ,
182170 volumeContext : map [string ]string {},
183171 expGID : nil ,
184172 expErr : false ,
185173 },
186- "FixedFSGroup=nil meta.VolumeMountGroup='70' FSGroupVolumeAttributeKey=defined but not present in context, should return 70" : {
187- fixedFSGroup : nil ,
174+ "meta.VolumeMountGroup='70' FSGroupVolumeAttributeKey=defined but not present in context, should return 70" : {
188175 metaVolumeMountGroup : "70" ,
189176 fsGroupVolumeAttributeKey : "fs-gid" ,
190177 volumeContext : map [string ]string {},
191178 expGID : intPtr (70 ),
192179 expErr : false ,
193180 },
194- "FixedFSGroup=nil meta.VolumeMountGroup='' FSGroupVolumeAttributeKey=defined and present in context, should return 20" : {
195- fixedFSGroup : nil ,
181+ "meta.VolumeMountGroup='' FSGroupVolumeAttributeKey=defined and present in context, should return 20" : {
196182 metaVolumeMountGroup : "" ,
197183 fsGroupVolumeAttributeKey : "fs-gid" ,
198184 volumeContext : map [string ]string {
@@ -201,8 +187,7 @@ func Test_fsGroupForMetadata(t *testing.T) {
201187 expGID : intPtr (20 ),
202188 expErr : false ,
203189 },
204- "FixedFSGroup=nil meta.VolumeMountGroup='10' FSGroupVolumeAttributeKey=defined and present in context, should return 20" : {
205- fixedFSGroup : nil ,
190+ "meta.VolumeMountGroup='10' FSGroupVolumeAttributeKey=defined and present in context, should return 20" : {
206191 metaVolumeMountGroup : "10" ,
207192 fsGroupVolumeAttributeKey : "fs-gid" ,
208193 volumeContext : map [string ]string {
@@ -211,8 +196,7 @@ func Test_fsGroupForMetadata(t *testing.T) {
211196 expGID : intPtr (20 ),
212197 expErr : false ,
213198 },
214- "FixedFSGroup=nil meta.VolumeMountGroup='' FSGroupVolumeAttributeKey=defined and present in context but value of 0, should error" : {
215- fixedFSGroup : nil ,
199+ "meta.VolumeMountGroup='' FSGroupVolumeAttributeKey=defined and present in context but value of 0, should error" : {
216200 metaVolumeMountGroup : "" ,
217201 fsGroupVolumeAttributeKey : "fs-gid" ,
218202 volumeContext : map [string ]string {
@@ -221,8 +205,7 @@ func Test_fsGroupForMetadata(t *testing.T) {
221205 expGID : nil ,
222206 expErr : true ,
223207 },
224- "FixedFSGroup=nil meta.VolumeMountGroup='' FSGroupVolumeAttributeKey=defined and present in context but value of -1, should error" : {
225- fixedFSGroup : nil ,
208+ "meta.VolumeMountGroup='' FSGroupVolumeAttributeKey=defined and present in context but value of -1, should error" : {
226209 metaVolumeMountGroup : "" ,
227210 fsGroupVolumeAttributeKey : "fs-gid" ,
228211 volumeContext : map [string ]string {
@@ -231,8 +214,7 @@ func Test_fsGroupForMetadata(t *testing.T) {
231214 expGID : nil ,
232215 expErr : true ,
233216 },
234- "FixedFSGroup=nil meta.VolumeMountGroup='' FSGroupVolumeAttributeKey=defined and present in context but value greater than the max gid, should error" : {
235- fixedFSGroup : nil ,
217+ "meta.VolumeMountGroup='' FSGroupVolumeAttributeKey=defined and present in context but value greater than the max gid, should error" : {
236218 metaVolumeMountGroup : "" ,
237219 fsGroupVolumeAttributeKey : "fs-gid" ,
238220 volumeContext : map [string ]string {
@@ -241,8 +223,7 @@ func Test_fsGroupForMetadata(t *testing.T) {
241223 expGID : nil ,
242224 expErr : true ,
243225 },
244- "FixedFSGroup=nil meta.VolumeMountGroup='' FSGroupVolumeAttributeKey=defined and present in context but with bad value, should return error" : {
245- fixedFSGroup : nil ,
226+ "meta.VolumeMountGroup='' FSGroupVolumeAttributeKey=defined and present in context but with bad value, should return error" : {
246227 metaVolumeMountGroup : "" ,
247228 fsGroupVolumeAttributeKey : "fs-gid" ,
248229 volumeContext : map [string ]string {
@@ -251,22 +232,11 @@ func Test_fsGroupForMetadata(t *testing.T) {
251232 expGID : nil ,
252233 expErr : true ,
253234 },
254- "FixedFSGroup=10 meta.VolumeMountGroup='' FSGroupVolumeAttributeKey=defined and present in context, should return superseding FixedFSGroup (10)" : {
255- fixedFSGroup : intPtr (10 ),
256- metaVolumeMountGroup : "" ,
257- fsGroupVolumeAttributeKey : "fs-gid" ,
258- volumeContext : map [string ]string {
259- "fs-gid" : "20" ,
260- },
261- expGID : intPtr (10 ),
262- expErr : false ,
263- },
264235 }
265236
266237 for name , test := range tests {
267238 t .Run (name , func (t * testing.T ) {
268239 f := Filesystem {
269- FixedFSGroup : test .fixedFSGroup ,
270240 FSGroupVolumeAttributeKey : test .fsGroupVolumeAttributeKey ,
271241 }
272242
0 commit comments