Skip to content

Commit 3ea4bc8

Browse files
authored
Skip certain tests when running post-deploy acceptance for staging (#107)
* Skip certain tests when running post-deploy acceptance for staging Signed-off-by: John Collier <[email protected]> * Skip proper test Signed-off-by: John Collier <[email protected]>
1 parent ba39985 commit 3ea4bc8

File tree

1 file changed

+61
-45
lines changed

1 file changed

+61
-45
lines changed

tests/integration/pkg/tests/indexserver_tests.go

Lines changed: 61 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -161,60 +161,72 @@ var _ = ginkgo.Describe("[Verify index server is working properly]", func() {
161161
})
162162

163163
ginkgo.It("/v2index/all endpoint should return stacks and samples", func() {
164-
registryIndex := util.GetRegistryIndex(config.Registry + "/v2index/all")
165-
166-
hasStacks := false
167-
hasSamples := false
168-
for _, index := range registryIndex {
169-
if index.Type == indexSchema.SampleDevfileType {
170-
hasSamples = true
171-
}
172-
if index.Type == indexSchema.StackDevfileType {
173-
hasStacks = true
164+
if config.IsTestRegistry {
165+
registryIndex := util.GetRegistryIndex(config.Registry + "/v2index/all")
166+
167+
hasStacks := false
168+
hasSamples := false
169+
for _, index := range registryIndex {
170+
if index.Type == indexSchema.SampleDevfileType {
171+
hasSamples = true
172+
}
173+
if index.Type == indexSchema.StackDevfileType {
174+
hasStacks = true
175+
}
174176
}
177+
gomega.Expect(hasStacks && hasSamples).To(gomega.BeTrue())
178+
} else {
179+
ginkgo.Skip("cannot guarantee test outside of test registry, skipping test")
175180
}
176-
gomega.Expect(hasStacks && hasSamples).To(gomega.BeTrue())
177181
})
178182

179183
ginkgo.It("/v2index/all?icon=base64 endpoint should return stacks and samples with encoded icon", func() {
180-
registryIndex := util.GetRegistryIndex(config.Registry + "/v2index/all?icon=base64")
184+
if config.IsTestRegistry {
185+
registryIndex := util.GetRegistryIndex(config.Registry + "/v2index/all?icon=base64")
181186

182-
hasStacks := false
183-
hasSamples := false
187+
hasStacks := false
188+
hasSamples := false
184189

185-
for _, index := range registryIndex {
186-
if index.Type == indexSchema.SampleDevfileType {
187-
hasSamples = true
188-
}
189-
if index.Type == indexSchema.StackDevfileType {
190-
hasStacks = true
191-
}
192-
if index.Icon != "" {
193-
gomega.Expect(index.Icon).To(gomega.HavePrefix("data:image"))
190+
for _, index := range registryIndex {
191+
if index.Type == indexSchema.SampleDevfileType {
192+
hasSamples = true
193+
}
194+
if index.Type == indexSchema.StackDevfileType {
195+
hasStacks = true
196+
}
197+
if index.Icon != "" {
198+
gomega.Expect(index.Icon).To(gomega.HavePrefix("data:image"))
199+
}
194200
}
201+
gomega.Expect(hasStacks && hasSamples).To(gomega.BeTrue())
202+
} else {
203+
ginkgo.Skip("cannot guarantee test outside of test registry, skipping test")
195204
}
196-
gomega.Expect(hasStacks && hasSamples).To(gomega.BeTrue())
197205
})
198206

199207
ginkgo.It("/v2index/all?arch=amd64&arch=arm64 endpoint should return stacks and samples for arch amd64 and arm64", func() {
200-
registryIndex := util.GetRegistryIndex(config.Registry + "/v2index/all?arch=amd64&arch=arm64")
201-
202-
hasStacks := false
203-
hasSamples := false
204-
for _, index := range registryIndex {
205-
if index.Type == indexSchema.SampleDevfileType {
206-
hasSamples = true
207-
}
208-
if index.Type == indexSchema.StackDevfileType {
209-
hasStacks = true
210-
}
211-
if len(index.Architectures) != 0 {
212-
gomega.Expect(index.Architectures).Should(gomega.ContainElements("amd64", "arm64"))
208+
if config.IsTestRegistry {
209+
registryIndex := util.GetRegistryIndex(config.Registry + "/v2index/all?arch=amd64&arch=arm64")
210+
211+
hasStacks := false
212+
hasSamples := false
213+
for _, index := range registryIndex {
214+
if index.Type == indexSchema.SampleDevfileType {
215+
hasSamples = true
216+
}
217+
if index.Type == indexSchema.StackDevfileType {
218+
hasStacks = true
219+
}
220+
if len(index.Architectures) != 0 {
221+
gomega.Expect(index.Architectures).Should(gomega.ContainElements("amd64", "arm64"))
222+
}
213223
}
214-
}
215224

216-
if len(registryIndex) > 0 {
217-
gomega.Expect(hasStacks && hasSamples).To(gomega.BeTrue())
225+
if len(registryIndex) > 0 {
226+
gomega.Expect(hasStacks && hasSamples).To(gomega.BeTrue())
227+
}
228+
} else {
229+
ginkgo.Skip("cannot guarantee test outside of test registry, skipping test")
218230
}
219231
})
220232

@@ -223,7 +235,7 @@ var _ = ginkgo.Describe("[Verify index server is working properly]", func() {
223235

224236
for _, index := range registryIndex {
225237
if len(index.Versions) != 0 {
226-
for _, version := range index.Versions{
238+
for _, version := range index.Versions {
227239
gomega.Expect(version.SchemaVersion).Should(gomega.HavePrefix("2.1"))
228240
}
229241
}
@@ -261,10 +273,14 @@ var _ = ginkgo.Describe("[Verify index server is working properly]", func() {
261273
})
262274

263275
ginkgo.It("/devfiles/<devfile>/<version> endpoint should return a devfile for samples", func() {
264-
parserArgs := parser.ParserArgs{
265-
URL: config.Registry + "/devfiles/code-with-quarkus/latest",
276+
if config.IsTestRegistry {
277+
parserArgs := parser.ParserArgs{
278+
URL: config.Registry + "/devfiles/code-with-quarkus/latest",
279+
}
280+
_, _, err := devfilePkg.ParseDevfileAndValidate(parserArgs)
281+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
282+
} else {
283+
ginkgo.Skip("cannot guarantee test outside of test registry, skipping test")
266284
}
267-
_, _, err := devfilePkg.ParseDevfileAndValidate(parserArgs)
268-
gomega.Expect(err).NotTo(gomega.HaveOccurred())
269285
})
270286
})

0 commit comments

Comments
 (0)