-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test (e2e) : Add E2E test for java app deploy workflow using Eclipse …
…JKube (#4397) + Added new test `application_deployment.feature` that would deploy a simple Quarkus application onto existing CRC cluster and verify that application is accessible via endpoint. + Perform JKube application deploy step in a Pod instead of podman container in order to skip oc login Signed-off-by: Rohan Kumar <[email protected]>
- Loading branch information
1 parent
d231c86
commit d485151
Showing
2 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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!"}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]>" | ||
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 |