Skip to content

Commit

Permalink
test(e2e): add tests for JVM workloads
Browse files Browse the repository at this point in the history
Also:
* speed up webhook e2e tests by not re-deploying the Dash0
  monitoring resource for every test
  • Loading branch information
basti1302 committed Jan 14, 2025
1 parent df328fc commit a54e5b4
Show file tree
Hide file tree
Showing 30 changed files with 1,397 additions and 374 deletions.
2 changes: 2 additions & 0 deletions test-resources/jvm/spring-boot/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/mvnw text eol=lf
*.cmd text eol=crlf
10 changes: 10 additions & 0 deletions test-resources/jvm/spring-boot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
1 change: 1 addition & 0 deletions test-resources/jvm/spring-boot/.m2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repository/*
Empty file.
4 changes: 4 additions & 0 deletions test-resources/jvm/spring-boot/.m2/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>/.m2/repository</localRepository>
</settings>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
13 changes: 13 additions & 0 deletions test-resources/jvm/spring-boot/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-FileCopyrightText: Copyright 2025 Dash0 Inc.
# SPDX-License-Identifier: Apache-2.0

ARG JDK_VERSION=24

FROM openjdk:${JDK_VERSION}-jdk-bookworm

COPY . .
COPY .m2 /m2

RUN JAVA_HOME=$(which java | xargs dirname | xargs dirname) "./mvnw" "-gs" "/m2/settings.xml" package

ENTRYPOINT [ "java", "-jar", "/target/app.jar" ]
37 changes: 37 additions & 0 deletions test-resources/jvm/spring-boot/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# SPDX-FileCopyrightText: Copyright 2024 Dash0 Inc.
# SPDX-License-Identifier: Apache-2.0

apiVersion: batch/v1
kind: CronJob
metadata:
name: dash0-operator-jvm-spring-boot-test-cronjob
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
metadata:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "1305"
spec:
restartPolicy: Never
containers:
- name: dash0-operator-jvm-spring-boot-test-cronjob-app
image: "dash0-operator-jvm-spring-boot-test-app:latest"
env:
- name: PORT
value: "1305"
- name: DASH0_DEBUG
value: "true"
- name: TRIGGER_SELF_AND_EXIT
value: "true"
ports:
- containerPort: 1305
imagePullPolicy: Never
readinessProbe:
httpGet:
path: /ready
port: 1305
initialDelaySeconds: 1
periodSeconds: 1
69 changes: 69 additions & 0 deletions test-resources/jvm/spring-boot/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# SPDX-FileCopyrightText: Copyright 2024 Dash0 Inc.
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: Service
metadata:
name: dash0-operator-jvm-spring-boot-test-daemonset-service
spec:
selector:
app: dash0-operator-jvm-spring-boot-test-daemonset-app
ports:
- port: 1306
targetPort: 1306
type: LoadBalancer
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: dash0-operator-jvm-spring-boot-test-daemonset
labels:
app: dash0-operator-jvm-spring-boot-test-daemonset-app
spec:
selector:
matchLabels:
app: dash0-operator-jvm-spring-boot-test-daemonset-app
template:
metadata:
labels:
app: dash0-operator-jvm-spring-boot-test-daemonset-app
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "1306"
spec:
containers:
- name: dash0-operator-jvm-spring-boot-test-daemonset-app
image: "dash0-operator-jvm-spring-boot-test-app:latest"
env:
- name: PORT
value: "1306"
- name: DASH0_DEBUG
value: "true"
ports:
- containerPort: 1306
imagePullPolicy: Never
readinessProbe:
httpGet:
path: /ready
port: 1306
initialDelaySeconds: 1
periodSeconds: 1
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dash0-operator-jvm-spring-boot-test-daemonset-ingress
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
rules:
- http:
paths:
- path: /daemonset(/|$)(.*)
pathType: ImplementationSpecific
backend:
service:
name: dash0-operator-jvm-spring-boot-test-daemonset-service
port:
number: 1306
70 changes: 70 additions & 0 deletions test-resources/jvm/spring-boot/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# SPDX-FileCopyrightText: Copyright 2024 Dash0 Inc.
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: Service
metadata:
name: dash0-operator-jvm-spring-boot-test-deployment-service
spec:
selector:
app: dash0-operator-jvm-spring-boot-test-deployment-app
ports:
- port: 1307
targetPort: 1307
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dash0-operator-jvm-spring-boot-test-deployment
labels:
app: dash0-operator-jvm-spring-boot-test-deployment-app
spec:
replicas: 1
selector:
matchLabels:
app: dash0-operator-jvm-spring-boot-test-deployment-app
template:
metadata:
labels:
app: dash0-operator-jvm-spring-boot-test-deployment-app
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "1307"
spec:
containers:
- name: dash0-operator-jvm-spring-boot-test-deployment-app
image: "dash0-operator-jvm-spring-boot-test-app:latest"
env:
- name: PORT
value: "1307"
- name: DASH0_DEBUG
value: "true"
ports:
- containerPort: 1307
imagePullPolicy: Never
readinessProbe:
httpGet:
path: /ready
port: 1307
initialDelaySeconds: 1
periodSeconds: 1
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dash0-operator-jvm-spring-boot-test-deployment-ingress
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
rules:
- http:
paths:
- path: /deployment(/|$)(.*)
pathType: ImplementationSpecific
backend:
service:
name: dash0-operator-jvm-spring-boot-test-deployment-service
port:
number: 1307
34 changes: 34 additions & 0 deletions test-resources/jvm/spring-boot/job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# SPDX-FileCopyrightText: Copyright 2024 Dash0 Inc.
# SPDX-License-Identifier: Apache-2.0

apiVersion: batch/v1
kind: Job
metadata:
name: dash0-operator-jvm-spring-boot-test-job
spec:
template:
metadata:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "1308"
spec:
restartPolicy: Never
containers:
- name: dash0-operator-jvm-spring-boot-test-job-app
image: "dash0-operator-jvm-spring-boot-test-app:latest"
env:
- name: PORT
value: "1308"
- name: DASH0_DEBUG
value: "true"
- name: TRIGGER_SELF_AND_EXIT
value: "true"
ports:
- containerPort: 1308
imagePullPolicy: Never
readinessProbe:
httpGet:
path: /ready
port: 1308
initialDelaySeconds: 1
periodSeconds: 1
Loading

0 comments on commit a54e5b4

Please sign in to comment.