32
32
channels = "preview"
33
33
defaultChannel = "preview"
34
34
35
- bundlePath1 = "manifests/prometheus/0.14.0"
36
- bundlePath2 = "manifests/prometheus/0.15.0"
37
- bundlePath3 = "manifests/prometheus/0.22.2"
38
- invalidBundlePath1 = "manifests/invalid-manifests/prometheus/0.22.2"
35
+ bundlePath1 = "manifests/prometheus/0.14.0"
36
+ bundlePath2 = "manifests/prometheus/0.15.0"
37
+ bundlePath3 = "manifests/prometheus/0.22.2"
39
38
40
39
bundleTag1 = rand .String (6 )
41
40
bundleTag2 = rand .String (6 )
@@ -69,12 +68,12 @@ func (bl bundleLocations) images() []string {
69
68
return images
70
69
}
71
70
72
- func inTemporaryBuildContext (f func () error ) (rerr error ) {
71
+ func inTemporaryBuildContext (f func () error , source string ) (rerr error ) {
73
72
td , err := ioutil .TempDir ("." , "opm-" )
74
73
if err != nil {
75
74
return err
76
75
}
77
- err = copy .Copy ("../../manifests" , filepath .Join (td , "manifests" ))
76
+ err = copy .Copy (source , filepath .Join (td , "manifests" ))
78
77
if err != nil {
79
78
return err
80
79
}
@@ -219,19 +218,19 @@ func initialize() error {
219
218
220
219
var _ = Describe ("opm" , func () {
221
220
IncludeSharedSpecs := func (containerTool string ) {
222
- Describe ("builds and validates a bundle image" , func () {
221
+ FDescribe ("builds and validates a bundle image" , func () {
223
222
var (
224
- path string
225
223
img string
226
224
unpackDir string
225
+ sourceDir string
227
226
validator bundle.BundleImageValidator
228
227
)
229
228
230
229
JustBeforeEach (func () {
231
230
By ("building bundle" )
232
231
err := inTemporaryBuildContext (func () error {
233
- return bundle .BuildFunc (path , "" , img , containerTool , packageName , channels , defaultChannel , false )
234
- })
232
+ return bundle .BuildFunc (bundlePath3 , "" , img , containerTool , packageName , channels , defaultChannel , false )
233
+ }, sourceDir )
235
234
Expect (err ).NotTo (HaveOccurred ())
236
235
237
236
By ("pushing bundle" )
@@ -259,8 +258,8 @@ var _ = Describe("opm", func() {
259
258
260
259
When ("the image is valid" , func () {
261
260
BeforeEach (func () {
262
- path = bundlePath3
263
261
img = bundleImage + ":" + bundleTag3
262
+ sourceDir = "../../manifests"
264
263
})
265
264
It ("should succeed" , func () {
266
265
Expect (validator .ValidateBundleFormat (unpackDir )).To (Succeed ())
@@ -272,8 +271,8 @@ var _ = Describe("opm", func() {
272
271
273
272
When ("the image is NOT valid" , func () {
274
273
BeforeEach (func () {
275
- path = invalidBundlePath1
276
274
img = bundleImage + ":" + rand .String (6 )
275
+ sourceDir = "../../test/e2e/testdata/invalid-manifests"
277
276
})
278
277
It ("should fail" , func () {
279
278
Expect (validator .ValidateBundleFormat (unpackDir )).To (Succeed ())
@@ -296,7 +295,7 @@ var _ = Describe("opm", func() {
296
295
for _ , b := range bundles {
297
296
err = inTemporaryBuildContext (func () error {
298
297
return bundle .BuildFunc (b .path , "" , b .image , containerTool , packageName , channels , defaultChannel , false )
299
- })
298
+ }, "../../manifests" )
300
299
Expect (err ).NotTo (HaveOccurred ())
301
300
}
302
301
0 commit comments