Skip to content

Commit c1ac222

Browse files
STONEBLD-1427 Setup Quickstarts Tests
1 parent 8fbe10d commit c1ac222

File tree

7 files changed

+103
-2
lines changed

7 files changed

+103
-2
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ openshift-e2e:
3333
openshift-e2e-periodic:
3434
KUBERNETES_CONFIG=${KUBECONFIG} go test -count 1 -tags periodic -timeout 180m -v ./openshift-with-appstudio-test/...
3535

36+
openshift-e2e-quickstarts:
37+
KUBERNETES_CONFIG=${KUBECONFIG} go test -count 1 -tags quickstarts -timeout 180m -v ./openshift-with-appstudio-test/...
38+
3639
minikube-test:
3740
go test -count 1 -tags minikube -timeout 180m -v ./openshift-with-appstudio-test/e2e
3841
build:
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: tekton.dev/v1beta1
2+
kind: PipelineRun
3+
metadata:
4+
generateName: quarkus-quickstart-build-
5+
spec:
6+
pipelineRef:
7+
name: sample-component-build
8+
params:
9+
- name: url
10+
value: https://github.com/devfile-samples/devfile-sample-code-with-quarkus.git
11+
- name: revision
12+
value: main
13+
workspaces:
14+
- name: maven-settings
15+
emptyDir: {}
16+
- name: shared-workspace
17+
volumeClaimTemplate:
18+
spec:
19+
accessModes:
20+
- ReadWriteOnce # access mode may affect how you can use this volume in parallel tasks
21+
resources:
22+
requests:
23+
storage: 5Gi
24+
taskRunSpecs:
25+
- pipelineTaskName: maven-run
26+
taskServiceAccountName: pipeline
27+

hack/examples/run-quickstarts.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
# This command runs the sample-component-build pipeline to build
4+
# the Quarkus getting-started quickstart: https://github.com/quarkusio/quarkus-quickstarts/tree/main/getting-started
5+
6+
DIR=`dirname "$0"`
7+
8+
echo
9+
echo "👉 Registering sample pipeline:"
10+
echo
11+
12+
kubectl apply -f $DIR/pipeline.yaml
13+
14+
kubectl apply -f $DIR/openshift-specific-rbac.yaml || true
15+
16+
echo
17+
echo "👉 Running the pipeline with a sample project:"
18+
echo
19+
20+
kubectl create -f $DIR/run-quarkus-quickstart.yaml
21+
kubectl create -f $DIR/run-spring-boot-quickstart.yaml
22+
23+
echo
24+
echo "🎉 Done! You can watch logs now with the following command: tkn pr logs --last -f"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: tekton.dev/v1beta1
2+
kind: PipelineRun
3+
metadata:
4+
generateName: spring-boot-quickstart-build-
5+
spec:
6+
pipelineRef:
7+
name: sample-component-build
8+
params:
9+
- name: url
10+
value: https://github.com/devfile-samples/devfile-sample-java-springboot-basic.git
11+
- name: revision
12+
value: main
13+
workspaces:
14+
- name: maven-settings
15+
emptyDir: {}
16+
- name: shared-workspace
17+
volumeClaimTemplate:
18+
spec:
19+
accessModes:
20+
- ReadWriteOnce # access mode may affect how you can use this volume in parallel tasks
21+
resources:
22+
requests:
23+
storage: 5Gi
24+
taskRunSpecs:
25+
- pipelineTaskName: maven-run
26+
taskServiceAccountName: pipeline
27+

openshift-with-appstudio-test/e2e/basictests.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ import (
2828
)
2929

3030
func runBasicTests(t *testing.T, doSetup func(t *testing.T, namespace string) *testArgs, namespace string) {
31+
runPipelineTests(t, doSetup, "run-e2e-shaded-app.yaml", namespace)
32+
}
3133

34+
func runPipelineTests(t *testing.T, doSetup func(t *testing.T, namespace string) *testArgs, pipeline string, namespace string) {
3235
ta := doSetup(t, namespace)
3336
defer GenerateStatusReport(ta.ns, jvmClient, kubeClient, tektonClient)
3437
//TODO, for now at least, keeping our test project to allow for analyzing the various CRD instances both for failure
@@ -42,7 +45,7 @@ func runBasicTests(t *testing.T, doSetup func(t *testing.T, namespace string) *t
4245
}
4346
ta.Logf(fmt.Sprintf("current working dir: %s", path))
4447

45-
runYamlPath := filepath.Join(path, "..", "..", "hack", "examples", "run-e2e-shaded-app.yaml")
48+
runYamlPath := filepath.Join(path, "..", "..", "hack", "examples", pipeline)
4649
ta.run = &v1beta1.PipelineRun{}
4750
var ok bool
4851
obj := streamFileYamlToTektonObj(runYamlPath, ta.run, ta)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//go:build quickstarts
2+
// +build quickstarts
3+
4+
package e2e
5+
6+
import (
7+
"testing"
8+
)
9+
10+
func TestQuarkusQuickstart(t *testing.T) {
11+
runPipelineTests(t, setup, "run-quarkus-quickstart.yaml", "quarkus")
12+
}
13+
14+
func TestSpringBootQuickstart(t *testing.T) {
15+
runPipelineTests(t, setup, "run-spring-boot-quickstart.yaml", "spring")
16+
}

openshift-with-appstudio-test/e2e/util.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ func setup(t *testing.T, namespace string) *testArgs {
268268
"maven-repository-300-jboss": "https://repository.jboss.org/nexus/content/groups/public/",
269269
"maven-repository-301-confluent": "https://packages.confluent.io/maven",
270270
"maven-repository-302-redhat": "https://maven.repository.redhat.com/ga",
271-
"maven-repository-303-jitpack": "https://jitpack.io"},
271+
"maven-repository-303-jitpack": "https://jitpack.io",
272+
"maven-repository-304-gradle": "https://repo.gradle.org/artifactory/libs-releases"},
272273

273274
CacheSettings: v1alpha1.CacheSettings{ //up the cache size, this is a lot of builds all at once, we could limit the number of pods instead but this gets the test done faster
274275
RequestMemory: "1024Mi",

0 commit comments

Comments
 (0)