Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,20 @@ jobs:
start args: '--addons=ingress'
- name: Run the devfile registry integration tests
run: .ci/run_tests_minikube_linux.sh

test_staging:
name: Test Staging Devfile Registry
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Go environment
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Run the devfile registry integration tests
run: |
# Run the integration tests
cd tests/integration
./docker-build.sh
docker run --env REGISTRY=https://registry.stage.devfile.io --env IS_TEST_REGISTRY=false devfile-registry-integration
101 changes: 54 additions & 47 deletions tests/integration/pkg/tests/indexserver_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,54 +322,68 @@ var _ = ginkgo.Describe("[Verify index server is working properly]", func() {
})

ginkgo.It("/devfiles/<devfile>/starter-projects/<starterProject> endpoint should return an offline zip archive for devfile starter project", func() {
resp, err := http.Get(config.Registry + "/devfiles/go/starter-projects/go-starter-offline")
var bytes []byte
if config.IsTestRegistry {
resp, err := http.Get(config.Registry + "/devfiles/go/starter-projects/go-starter-offline")
var bytes []byte

gomega.Expect(err).NotTo(gomega.HaveOccurred())
defer resp.Body.Close()
gomega.Expect(err).NotTo(gomega.HaveOccurred())
defer resp.Body.Close()

bytes, err = ioutil.ReadAll(resp.Body)
bytes, err = ioutil.ReadAll(resp.Body)

gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusAccepted))
gomega.Expect(bytes).ToNot(gomega.BeEmpty())
gomega.Expect(bytes).To(gomega.Satisfy(func(file []byte) bool {
return http.DetectContentType(file) == "application/zip"
}))
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusAccepted))
gomega.Expect(bytes).ToNot(gomega.BeEmpty())
gomega.Expect(bytes).To(gomega.Satisfy(func(file []byte) bool {
return http.DetectContentType(file) == "application/zip"
}))
} else {
ginkgo.Skip("cannot guarantee test outside of test registry, skipping test")
}
})

ginkgo.It("/devfiles/<devfile>/<version>/starter-projects/<starterProject> endpoint should return an offline zip archive for devfile starter project", func() {
resp, err := http.Get(config.Registry + "/devfiles/go/1.2.0/starter-projects/go-starter-offline")
var bytes []byte
if config.IsTestRegistry {

gomega.Expect(err).NotTo(gomega.HaveOccurred())
defer resp.Body.Close()
resp, err := http.Get(config.Registry + "/devfiles/go/1.2.0/starter-projects/go-starter-offline")
var bytes []byte

bytes, err = ioutil.ReadAll(resp.Body)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
defer resp.Body.Close()

gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusAccepted))
gomega.Expect(bytes).ToNot(gomega.BeEmpty())
gomega.Expect(bytes).To(gomega.Satisfy(func(file []byte) bool {
return http.DetectContentType(file) == "application/zip"
}))
bytes, err = ioutil.ReadAll(resp.Body)

gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusAccepted))
gomega.Expect(bytes).ToNot(gomega.BeEmpty())
gomega.Expect(bytes).To(gomega.Satisfy(func(file []byte) bool {
return http.DetectContentType(file) == "application/zip"
}))
} else {
ginkgo.Skip("cannot guarantee test outside of test registry, skipping test")
}
})

ginkgo.It("/devfiles/<devfile>/starter-projects/<starterProject> endpoint should return an offline zip archive of a subdir for devfile starter project", func() {
resp, err := http.Get(config.Registry + "/devfiles/java-quarkus/starter-projects/community-offline")
var bytes []byte
if config.IsTestRegistry {

gomega.Expect(err).NotTo(gomega.HaveOccurred())
defer resp.Body.Close()
resp, err := http.Get(config.Registry + "/devfiles/java-quarkus/starter-projects/community-offline")
var bytes []byte

bytes, err = ioutil.ReadAll(resp.Body)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
defer resp.Body.Close()

gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusAccepted))
gomega.Expect(bytes).ToNot(gomega.BeEmpty())
gomega.Expect(bytes).To(gomega.Satisfy(func(file []byte) bool {
return http.DetectContentType(file) == "application/zip"
}))
bytes, err = ioutil.ReadAll(resp.Body)

gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusAccepted))
gomega.Expect(bytes).ToNot(gomega.BeEmpty())
gomega.Expect(bytes).To(gomega.Satisfy(func(file []byte) bool {
return http.DetectContentType(file) == "application/zip"
}))
} else {
ginkgo.Skip("cannot guarantee test outside of test registry, skipping test")
}
})

ginkgo.It("/devfiles/<devfile>/starter-projects/<starterProject> endpoint should return an error for an offline starter project file location that doesn't exist", func() {
Expand All @@ -384,25 +398,18 @@ var _ = ginkgo.Describe("[Verify index server is working properly]", func() {
})

ginkgo.It("/devfiles/<devfile>/starter-projects/<starterProject> endpoint should return an error for a devfile that doesn't exist", func() {
if config.IsTestRegistry {
resp, err := http.Get(config.Registry + "/devfiles/fake-stack/starter-projects/springbootproject")
resp, err := http.Get(config.Registry + "/devfiles/fake-stack/starter-projects/springbootproject")

gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusNotFound))
} else {
ginkgo.Skip("cannot guarantee test outside of test registry, skipping test")
}
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusNotFound))

})

ginkgo.It("/devfiles/<devfile>/starter-projects/<starterProject> endpoint should return an error for a starter project that doesn't exist", func() {
if config.IsTestRegistry {
resp, err := http.Get(config.Registry + "/devfiles/java-maven/starter-projects/fake-project")

gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusNotFound))
} else {
ginkgo.Skip("cannot guarantee test outside of test registry, skipping test")
}
resp, err := http.Get(config.Registry + "/devfiles/java-maven/starter-projects/fake-project")

gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusNotFound))
})
})