Skip to content

Commit 4503f63

Browse files
Add e2e test (#1)
* Add e2e test * Use kind for e2e workflow * Make resources configurable for CI
1 parent e7a2108 commit 4503f63

12 files changed

Lines changed: 211 additions & 39 deletions

.github/workflows/helm-e2e.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Helm Chart End-to-End Test
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'chart/**'
7+
- '.github/workflows/**'
8+
push:
9+
paths:
10+
- 'chart/**'
11+
- '.github/workflows/**'
12+
13+
jobs:
14+
e2e:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
env:
19+
RELEASE_NAME: openops
20+
NAMESPACE: openops
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up Helm
25+
uses: azure/setup-helm@v4
26+
with:
27+
version: v3.14.4
28+
29+
- name: Create kind cluster
30+
uses: helm/kind-action@v1.9.0
31+
with:
32+
cluster_name: openops-e2e
33+
wait: 180s
34+
35+
- name: Verify cluster
36+
run: |
37+
set -euo pipefail
38+
kubectl cluster-info
39+
kubectl get nodes -o wide
40+
41+
- name: Deploy chart
42+
run: |
43+
set -euo pipefail
44+
helm upgrade --install "$RELEASE_NAME" chart \
45+
--namespace "$NAMESPACE" \
46+
--create-namespace \
47+
-f chart/values.ci.yaml \
48+
--set nginx.service.type=ClusterIP \
49+
--wait \
50+
--timeout 20m
51+
52+
- name: Wait for workloads
53+
run: |
54+
set -euo pipefail
55+
kubectl get pods -n "$NAMESPACE" -o wide
56+
kubectl wait --for=condition=Available deployment --all -n "$NAMESPACE" --timeout=900s
57+
58+
- name: Verify application health endpoint
59+
run: |
60+
set -euo pipefail
61+
kubectl get svc -n "$NAMESPACE"
62+
kubectl port-forward -n "$NAMESPACE" svc/openops-app 18080:80 >/tmp/port-forward.log 2>&1 &
63+
pf_pid=$!
64+
cleanup() {
65+
kill "$pf_pid" >/dev/null 2>&1 || true
66+
}
67+
trap cleanup EXIT
68+
for attempt in $(seq 1 12); do
69+
if curl -fsS http://127.0.0.1:18080/api/v1/health; then
70+
echo "Health endpoint responded on attempt $attempt"
71+
exit 0
72+
fi
73+
sleep 5
74+
done
75+
echo "Health endpoint did not become ready" >&2
76+
exit 1
77+
78+
- name: Gather diagnostics on failure
79+
if: ${{ failure() }}
80+
run: |
81+
kubectl get all -n "$NAMESPACE"
82+
kubectl describe pods -n "$NAMESPACE" || true
83+
kubectl logs -n "$NAMESPACE" deployment/openops-app --tail=200 || true

chart/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
values.*.yaml
22
!values.overrides-example.yaml
3+
!values.ci.yaml

chart/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ apiVersion: v2
22
name: openops
33
description: A Helm chart for the OpenOps platform
44
type: application
5-
version: 0.1.0
5+
version: 0.1.1
66
appVersion: "latest"
77
icon: https://openops.com/favicon.ico

chart/templates/deployment-analytics.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@ spec:
2222
{{ include "openops.renderEnv" (dict "root" . "env" .Values.analytics.env) | nindent 10 }}
2323
ports:
2424
- containerPort: 8088
25+
{{- with .Values.analytics.resources }}
2526
resources:
26-
requests:
27-
memory: "1Gi"
28-
cpu: "500m"
29-
limits:
30-
memory: "2Gi"
31-
cpu: "1000m"
27+
{{ toYaml . | indent 10 }}
28+
{{- end }}
3229
livenessProbe:
3330
httpGet:
3431
path: /health

chart/templates/deployment-app.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,10 @@ spec:
2626
{{ include "openops.renderEnv" (dict "root" . "env" .Values.openopsEnv) | nindent 12 }}
2727
ports:
2828
- containerPort: 80
29+
{{- with .Values.app.resources }}
2930
resources:
30-
requests:
31-
memory: "1Gi"
32-
cpu: "500m"
33-
limits:
34-
memory: "2Gi"
35-
cpu: "1000m"
31+
{{ toYaml . | indent 12 }}
32+
{{- end }}
3633
readinessProbe:
3734
httpGet:
3835
path: /api/v1/health

chart/templates/deployment-engine.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ spec:
2828
{{ include "openops.renderEnv" (dict "root" . "env" .Values.engine.env) | nindent 12 }}
2929
ports:
3030
- containerPort: 3005
31+
{{- with .Values.engine.resources }}
3132
resources:
32-
requests:
33-
memory: "512Mi"
34-
cpu: "250m"
35-
limits:
36-
memory: "1Gi"
37-
cpu: "500m"
33+
{{ toYaml . | indent 12 }}
34+
{{- end }}

chart/templates/deployment-nginx.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@ spec:
2020
imagePullPolicy: {{ .Values.image.pullPolicy }}
2121
ports:
2222
- containerPort: 80
23+
{{- with .Values.nginx.resources }}
2324
resources:
24-
requests:
25-
memory: "128Mi"
26-
cpu: "100m"
27-
limits:
28-
memory: "256Mi"
29-
cpu: "200m"
25+
{{ toYaml . | indent 8 }}
26+
{{- end }}
3027
volumeMounts:
3128
- name: nginx-config
3229
mountPath: /etc/nginx/conf.d/default.conf

chart/templates/deployment-postgres.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@ spec:
2828
value: "/var/lib/postgresql/data/pgdata"
2929
ports:
3030
- containerPort: 5432
31+
{{- with .Values.postgres.resources }}
3132
resources:
32-
requests:
33-
memory: "512Mi"
34-
cpu: "250m"
35-
limits:
36-
memory: "1Gi"
37-
cpu: "500m"
33+
{{ toYaml . | indent 8 }}
34+
{{- end }}
3835
volumeMounts:
3936
- name: postgres-data
4037
mountPath: /var/lib/postgresql/data

chart/templates/deployment-redis.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@ spec:
2020
imagePullPolicy: {{ .Values.image.pullPolicy }}
2121
ports:
2222
- containerPort: 6379
23+
{{- with .Values.redis.resources }}
2324
resources:
24-
requests:
25-
memory: "256Mi"
26-
cpu: "100m"
27-
limits:
28-
memory: "512Mi"
29-
cpu: "200m"
25+
{{ toYaml . | indent 8 }}
26+
{{- end }}
3027
volumeMounts:
3128
- name: redis-data
3229
mountPath: /data

chart/templates/deployment-tables.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ spec:
2020
imagePullPolicy: {{ .Values.image.pullPolicy }}
2121
env:
2222
{{ include "openops.renderEnv" (dict "root" . "env" .Values.tables.env) | nindent 10 }}
23+
{{- with .Values.tables.resources }}
2324
resources:
24-
requests:
25-
memory: "512Mi"
25+
{{ toYaml . | indent 10 }}
26+
{{- end }}
2627
volumeMounts:
2728
- name: tables-data
2829
mountPath: /baserow/data

0 commit comments

Comments
 (0)