@@ -322,54 +322,68 @@ var _ = ginkgo.Describe("[Verify index server is working properly]", func() {
322
322
})
323
323
324
324
ginkgo .It ("/devfiles/<devfile>/starter-projects/<starterProject> endpoint should return an offline zip archive for devfile starter project" , func () {
325
- resp , err := http .Get (config .Registry + "/devfiles/go/starter-projects/go-starter-offline" )
326
- var bytes []byte
325
+ if config .IsTestRegistry {
326
+ resp , err := http .Get (config .Registry + "/devfiles/go/starter-projects/go-starter-offline" )
327
+ var bytes []byte
327
328
328
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
329
- defer resp .Body .Close ()
329
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
330
+ defer resp .Body .Close ()
330
331
331
- bytes , err = ioutil .ReadAll (resp .Body )
332
+ bytes , err = ioutil .ReadAll (resp .Body )
332
333
333
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
334
- gomega .Expect (resp .StatusCode ).To (gomega .Equal (http .StatusAccepted ))
335
- gomega .Expect (bytes ).ToNot (gomega .BeEmpty ())
336
- gomega .Expect (bytes ).To (gomega .Satisfy (func (file []byte ) bool {
337
- return http .DetectContentType (file ) == "application/zip"
338
- }))
334
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
335
+ gomega .Expect (resp .StatusCode ).To (gomega .Equal (http .StatusAccepted ))
336
+ gomega .Expect (bytes ).ToNot (gomega .BeEmpty ())
337
+ gomega .Expect (bytes ).To (gomega .Satisfy (func (file []byte ) bool {
338
+ return http .DetectContentType (file ) == "application/zip"
339
+ }))
340
+ } else {
341
+ ginkgo .Skip ("cannot guarantee test outside of test registry, skipping test" )
342
+ }
339
343
})
340
344
341
345
ginkgo .It ("/devfiles/<devfile>/<version>/starter-projects/<starterProject> endpoint should return an offline zip archive for devfile starter project" , func () {
342
- resp , err := http .Get (config .Registry + "/devfiles/go/1.2.0/starter-projects/go-starter-offline" )
343
- var bytes []byte
346
+ if config .IsTestRegistry {
344
347
345
- gomega . Expect ( err ). NotTo ( gomega . HaveOccurred () )
346
- defer resp . Body . Close ()
348
+ resp , err := http . Get ( config . Registry + "/devfiles/go/1.2.0/starter-projects/go-starter-offline" )
349
+ var bytes [] byte
347
350
348
- bytes , err = ioutil .ReadAll (resp .Body )
351
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
352
+ defer resp .Body .Close ()
349
353
350
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
351
- gomega .Expect (resp .StatusCode ).To (gomega .Equal (http .StatusAccepted ))
352
- gomega .Expect (bytes ).ToNot (gomega .BeEmpty ())
353
- gomega .Expect (bytes ).To (gomega .Satisfy (func (file []byte ) bool {
354
- return http .DetectContentType (file ) == "application/zip"
355
- }))
354
+ bytes , err = ioutil .ReadAll (resp .Body )
355
+
356
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
357
+ gomega .Expect (resp .StatusCode ).To (gomega .Equal (http .StatusAccepted ))
358
+ gomega .Expect (bytes ).ToNot (gomega .BeEmpty ())
359
+ gomega .Expect (bytes ).To (gomega .Satisfy (func (file []byte ) bool {
360
+ return http .DetectContentType (file ) == "application/zip"
361
+ }))
362
+ } else {
363
+ ginkgo .Skip ("cannot guarantee test outside of test registry, skipping test" )
364
+ }
356
365
})
357
366
358
367
ginkgo .It ("/devfiles/<devfile>/starter-projects/<starterProject> endpoint should return an offline zip archive of a subdir for devfile starter project" , func () {
359
- resp , err := http .Get (config .Registry + "/devfiles/java-quarkus/starter-projects/community-offline" )
360
- var bytes []byte
368
+ if config .IsTestRegistry {
361
369
362
- gomega . Expect ( err ). NotTo ( gomega . HaveOccurred () )
363
- defer resp . Body . Close ()
370
+ resp , err := http . Get ( config . Registry + "/devfiles/java-quarkus/starter-projects/community-offline" )
371
+ var bytes [] byte
364
372
365
- bytes , err = ioutil .ReadAll (resp .Body )
373
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
374
+ defer resp .Body .Close ()
366
375
367
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
368
- gomega .Expect (resp .StatusCode ).To (gomega .Equal (http .StatusAccepted ))
369
- gomega .Expect (bytes ).ToNot (gomega .BeEmpty ())
370
- gomega .Expect (bytes ).To (gomega .Satisfy (func (file []byte ) bool {
371
- return http .DetectContentType (file ) == "application/zip"
372
- }))
376
+ bytes , err = ioutil .ReadAll (resp .Body )
377
+
378
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
379
+ gomega .Expect (resp .StatusCode ).To (gomega .Equal (http .StatusAccepted ))
380
+ gomega .Expect (bytes ).ToNot (gomega .BeEmpty ())
381
+ gomega .Expect (bytes ).To (gomega .Satisfy (func (file []byte ) bool {
382
+ return http .DetectContentType (file ) == "application/zip"
383
+ }))
384
+ } else {
385
+ ginkgo .Skip ("cannot guarantee test outside of test registry, skipping test" )
386
+ }
373
387
})
374
388
375
389
ginkgo .It ("/devfiles/<devfile>/starter-projects/<starterProject> endpoint should return an error for an offline starter project file location that doesn't exist" , func () {
@@ -384,25 +398,18 @@ var _ = ginkgo.Describe("[Verify index server is working properly]", func() {
384
398
})
385
399
386
400
ginkgo .It ("/devfiles/<devfile>/starter-projects/<starterProject> endpoint should return an error for a devfile that doesn't exist" , func () {
387
- if config .IsTestRegistry {
388
- resp , err := http .Get (config .Registry + "/devfiles/fake-stack/starter-projects/springbootproject" )
401
+ resp , err := http .Get (config .Registry + "/devfiles/fake-stack/starter-projects/springbootproject" )
389
402
390
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
391
- gomega .Expect (resp .StatusCode ).To (gomega .Equal (http .StatusNotFound ))
392
- } else {
393
- ginkgo .Skip ("cannot guarantee test outside of test registry, skipping test" )
394
- }
403
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
404
+ gomega .Expect (resp .StatusCode ).To (gomega .Equal (http .StatusNotFound ))
395
405
396
406
})
397
407
398
408
ginkgo .It ("/devfiles/<devfile>/starter-projects/<starterProject> endpoint should return an error for a starter project that doesn't exist" , func () {
399
- if config .IsTestRegistry {
400
- resp , err := http .Get (config .Registry + "/devfiles/java-maven/starter-projects/fake-project" )
401
409
402
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
403
- gomega .Expect (resp .StatusCode ).To (gomega .Equal (http .StatusNotFound ))
404
- } else {
405
- ginkgo .Skip ("cannot guarantee test outside of test registry, skipping test" )
406
- }
410
+ resp , err := http .Get (config .Registry + "/devfiles/java-maven/starter-projects/fake-project" )
411
+
412
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
413
+ gomega .Expect (resp .StatusCode ).To (gomega .Equal (http .StatusNotFound ))
407
414
})
408
415
})
0 commit comments