diff --git a/test/e2e/features/application_deployment.feature b/test/e2e/features/application_deployment.feature new file mode 100644 index 0000000000..718cadc8a3 --- /dev/null +++ b/test/e2e/features/application_deployment.feature @@ -0,0 +1,37 @@ +@story_application_deployment +Feature: Application Deployment Test + + User deploys a basic java application onto CRC cluster and expects that it's + deployed successfully and is accessible via route + + Background: + Given ensuring CRC cluster is running + And ensuring oc command is available + And ensuring user is logged in succeeds + + @testdata @linux @windows @darwin @cleanup @needs_namespace + Scenario: Deploy a java application using Eclipse JKube in pod and then verify it's health + When executing "oc new-project testproj" succeeds + And executing "oc create -f jkube-kubernetes-build-resources.yaml" succeeds + And executing "oc start-build jkube-application-deploy-buildconfig --follow" succeeds + And executing "oc rollout status -w dc/jkube-application-deploy-test --timeout=600s" succeeds + Then stdout should contain "successfully rolled out" + And executing "oc logs -lapp=jkube-application-deploy-test -f" succeeds + And executing "oc rollout status -w dc/quarkus --timeout=600s" succeeds + Then stdout should contain "successfully rolled out" + And executing "oc get build -lapp=quarkus" succeeds + Then stdout should contain "quarkus-s2i" + And executing "oc get buildconfig -lapp=quarkus" succeeds + Then stdout should contain "quarkus-s2i" + And executing "oc get imagestream -lapp=quarkus" succeeds + Then stdout should contain "quarkus" + And executing "oc get pods -lapp=quarkus" succeeds + Then stdout should contain "quarkus" + And stdout should contain "1/1 Running" + And executing "oc get svc -lapp=quarkus" succeeds + Then stdout should contain "quarkus" + And executing "oc get routes -lapp=quarkus" succeeds + Then stdout should contain "quarkus" + And with up to "4" retries with wait period of "1m" http response from "http://quarkus-testproj.apps-crc.testing" has status code "200" + Then executing "curl -s http://quarkus-testproj.apps-crc.testing" succeeds + And stdout should contain "{"applicationName":"JKube","message":"Subatomic JKube really whips the llama's ass!"}" diff --git a/test/testdata/jkube-kubernetes-build-resources.yaml b/test/testdata/jkube-kubernetes-build-resources.yaml new file mode 100644 index 0000000000..e27fac81c6 --- /dev/null +++ b/test/testdata/jkube-kubernetes-build-resources.yaml @@ -0,0 +1,146 @@ +apiVersion: v1 +kind: List +items: + - apiVersion: rbac.authorization.k8s.io/v1 + kind: Role + metadata: + name: jkube-application-deploy-role + labels: + app: jkube-application-deploy-test + rules: + - apiGroups: + - "" + resources: + - secrets + - pods + - pods/log + - services + - events + verbs: + - create + - get + - list + - update + - watch + - patch + - apiGroups: + - apps.openshift.io + resources: + - deploymentconfigs + verbs: + - create + - get + - list + - update + - patch + - apiGroups: + - build.openshift.io + resources: + - buildconfigs + - buildconfigs/instantiatebinary + - builds + verbs: ["*"] + - apiGroups: + - image.openshift.io + resources: + - imagestreams + verbs: + - create + - get + - list + - update + - patch + - apiGroups: + - route.openshift.io + resources: + - routes + verbs: + - create + - get + - list + - update + - patch + - apiVersion: rbac.authorization.k8s.io/v1 + kind: RoleBinding + metadata: + name: jkube-application-deploy-binding + labels: + app: jkube-application-deploy-test + roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: jkube-application-deploy-role + subjects: + - kind: ServiceAccount + name: jkube-application-deploy-sa + - apiVersion: v1 + kind: ServiceAccount + metadata: + name: jkube-application-deploy-sa + labels: + app: jkube-application-deploy-test + - apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + labels: + app: jkube-application-deploy-test + name: jkube-application-deploy-is + - apiVersion: build.openshift.io/v1 + kind: BuildConfig + metadata: + name: jkube-application-deploy-buildconfig + labels: + app: jkube-application-deploy-test + spec: + output: + to: + kind: ImageStreamTag + name: jkube-application-deploy-is:latest + source: + type: Dockerfile + dockerfile: | + FROM registry.access.redhat.com/ubi9/openjdk-17:1.20-2.1726695177 + LABEL org.opencontainers.image.authors="CRCQE " + USER root + # Install Git + RUN microdnf install -y git + RUN git clone https://github.com/eclipse-jkube/jkube.git + RUN chmod -R 775 /home/default/jkube + WORKDIR /home/default/jkube/quickstarts/maven/quarkus + RUN mkdir foo + ENTRYPOINT ["mvn", "package", "oc:build", "oc:resource", "oc:apply"] + strategy: + type: Docker + - apiVersion: apps.openshift.io/v1 + kind: DeploymentConfig + metadata: + labels: + app: jkube-application-deploy-test + name: jkube-application-deploy-test + spec: + replicas: 1 + selector: + app: jkube-application-deploy-test + template: + metadata: + labels: + app: jkube-application-deploy-test + name: jkube-application-deploy-test + spec: + containers: + - image: jkube-application-deploy-is:latest + imagePullPolicy: IfNotPresent + name: maven-pod + securityContext: + privileged: false + serviceAccount: jkube-application-deploy-sa + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - maven-pod + from: + kind: ImageStreamTag + name: jkube-application-deploy-is:latest + type: ImageChange