Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test (e2e) : Add E2E test for java app deploy workflow using Eclipse JKube (#4397) #4414

Merged
merged 1 commit into from
Nov 14, 2024
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
37 changes: 37 additions & 0 deletions test/e2e/features/application_deployment.feature
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!"}"
146 changes: 146 additions & 0 deletions test/testdata/jkube-kubernetes-build-resources.yaml
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 <devtools-crc-qe@redhat.com>"
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
Loading