@@ -141,7 +141,7 @@ var _ = Describe("Generating a ClusterServiceVersion", func() {
141
141
}
142
142
Expect (g .Generate (cfg , opts ... )).ToNot (HaveOccurred ())
143
143
outputFile := filepath .Join (tmp , "bases" , makeCSVFileName (operatorName ))
144
- outputFileContents := removeSDKLabelsFromCSVString ( string ( readFileHelper (outputFile )) )
144
+ outputFileContents := readFileHelper (outputFile )
145
145
Expect (outputFile ).To (BeAnExistingFile ())
146
146
Expect (outputFileContents ).To (MatchYAML (baseCSVUIMetaStr ))
147
147
})
@@ -178,7 +178,7 @@ var _ = Describe("Generating a ClusterServiceVersion", func() {
178
178
}
179
179
Expect (g .Generate (cfg , opts ... )).ToNot (HaveOccurred ())
180
180
outputFile := filepath .Join (tmp , bundle .ManifestsDir , makeCSVFileName (operatorName ))
181
- outputFileContents := removeSDKLabelsFromCSVString ( string ( readFileHelper (outputFile )) )
181
+ outputFileContents := readFileHelper (outputFile )
182
182
Expect (outputFile ).To (BeAnExistingFile ())
183
183
Expect (outputFileContents ).To (MatchYAML (newCSVStr ))
184
184
})
@@ -195,8 +195,9 @@ var _ = Describe("Generating a ClusterServiceVersion", func() {
195
195
}
196
196
Expect (g .Generate (cfg , opts ... )).ToNot (HaveOccurred ())
197
197
outputFile := filepath .Join (tmp , g .Version , makeCSVFileName (operatorName ))
198
+ outputFileContents := readFileHelper (outputFile )
198
199
Expect (outputFile ).To (BeAnExistingFile ())
199
- Expect (string ( readFileHelper ( outputFile )) ).To (MatchYAML (newCSVStr ))
200
+ Expect (outputFileContents ).To (MatchYAML (newCSVStr ))
200
201
})
201
202
202
203
It ("should write a ClusterServiceVersion manifest to a legacy bundle file" , func () {
@@ -212,7 +213,7 @@ var _ = Describe("Generating a ClusterServiceVersion", func() {
212
213
}
213
214
Expect (g .GenerateLegacy (opts ... )).ToNot (HaveOccurred ())
214
215
outputFile := filepath .Join (tmp , bundle .ManifestsDir , makeCSVFileName (operatorName ))
215
- outputFileContents := removeSDKLabelsFromCSVString ( string ( readFileHelper (outputFile )) )
216
+ outputFileContents := readFileHelper (outputFile )
216
217
Expect (outputFile ).To (BeAnExistingFile ())
217
218
Expect (outputFileContents ).To (MatchYAML (newCSVStr ))
218
219
})
@@ -280,46 +281,28 @@ var _ = Describe("Generating a ClusterServiceVersion", func() {
280
281
})
281
282
})
282
283
283
- Context ("to create a new" , func () {
284
-
285
- Context ("bundle base" , func () {
286
- It ("should return the default base object" , func () {
287
- g = Generator {
288
- OperatorName : operatorName ,
289
- OperatorType : operatorType ,
290
- config : cfg ,
291
- getBase : makeBaseGetter (baseCSV ),
292
- }
293
- csv , err := g .generate ()
294
- Expect (err ).ToNot (HaveOccurred ())
295
- Expect (csv ).To (Equal (baseCSV ))
296
- })
297
- It ("should return a base object with customresourcedefinitions" , func () {
298
- g = Generator {
299
- OperatorName : operatorName ,
300
- OperatorType : operatorType ,
301
- config : cfg ,
302
- getBase : makeBaseGetter (baseCSVUIMeta ),
303
- }
304
- csv , err := g .generate ()
305
- Expect (err ).ToNot (HaveOccurred ())
306
- Expect (csv ).To (Equal (baseCSVUIMeta ))
307
- })
284
+ Context ("to create a new base ClusterServiceVersion" , func () {
285
+ It ("should return the default base object" , func () {
286
+ g = Generator {
287
+ OperatorName : operatorName ,
288
+ OperatorType : operatorType ,
289
+ config : cfg ,
290
+ getBase : makeBaseGetter (baseCSV ),
291
+ }
292
+ csv , err := g .generate ()
293
+ Expect (err ).ToNot (HaveOccurred ())
294
+ Expect (csv ).To (Equal (baseCSV ))
308
295
})
309
- Context ("bundle" , func () {
310
- It ("should return the expected object" , func () {
311
- g = Generator {
312
- OperatorName : operatorName ,
313
- OperatorType : operatorType ,
314
- Version : version ,
315
- Collector : col ,
316
- config : cfg ,
317
- getBase : makeBaseGetter (baseCSVUIMeta ),
318
- }
319
- csv , err := g .generate ()
320
- Expect (err ).ToNot (HaveOccurred ())
321
- Expect (csv ).To (Equal (newCSV ))
322
- })
296
+ It ("should return a base object with customresourcedefinitions" , func () {
297
+ g = Generator {
298
+ OperatorName : operatorName ,
299
+ OperatorType : operatorType ,
300
+ config : cfg ,
301
+ getBase : makeBaseGetter (baseCSVUIMeta ),
302
+ }
303
+ csv , err := g .generate ()
304
+ Expect (err ).ToNot (HaveOccurred ())
305
+ Expect (csv ).To (Equal (baseCSVUIMeta ))
323
306
})
324
307
})
325
308
@@ -380,7 +363,6 @@ var _ = Describe("Generating a ClusterServiceVersion", func() {
380
363
Expect (csv ).To (Equal (upgradeCSV (newCSV , g .OperatorName , g .Version )))
381
364
})
382
365
})
383
-
384
366
})
385
367
386
368
})
@@ -445,10 +427,10 @@ func initTestCSVsHelper() {
445
427
ExpectWithOffset (1 , err ).ToNot (HaveOccurred ())
446
428
}
447
429
448
- func readFileHelper (path string ) [] byte {
430
+ func readFileHelper (path string ) string {
449
431
b , err := ioutil .ReadFile (path )
450
432
ExpectWithOffset (1 , err ).ToNot (HaveOccurred ())
451
- return b
433
+ return removeSDKLabelsFromCSVString ( string ( b ))
452
434
}
453
435
454
436
func modifyCSVDepImageHelper (tag string ) func (csv * v1alpha1.ClusterServiceVersion ) {
0 commit comments