Files
homelab-frontend/k8s/integration-test-job.yaml
T

78 lines
2.0 KiB
YAML
Raw Normal View History

apiVersion: batch/v1
kind: Job
metadata:
name: api-gateway-integration-test
namespace: api
spec:
template:
metadata:
labels:
app: api-gateway
managed-by: test
role: integration-test
spec:
serviceAccountName: api-gateway
restartPolicy: Never
containers:
- name: integration-tester
image: forgejo.riotpiao.com/rock/api-gateway:latest
imagePullPolicy: Always
workingDir: /app
command:
- /bin/sh
- -c
- |
set -e
echo "Starting integration tests..."
echo "Gateway URL: http://api-gateway:8080"
# Wait for gateway service to be ready
echo "Waiting for gateway service to be ready..."
for i in $(seq 1 30); do
if curl -s http://api-gateway:8080/healthz > /dev/null 2>&1; then
echo "✓ Gateway is ready"
break
fi
echo "Waiting for gateway... ($i/30)"
sleep 2
done
# Run integration tests
echo "Running integration tests..."
go test -v -tags=integration -timeout=5m ./internal/integration/...
echo "✓ Integration tests completed"
env:
- name: GATEWAY_URL
value: "http://api-gateway:8080"
- name: CI
value: "true"
resources:
requests:
cpu: 250m
memory: 512Mi
limits:
cpu: 500m
memory: 1Gi
securityContext:
runAsNonRoot: true
runAsUser: 65532
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
volumeMounts:
- name: tmp
mountPath: /tmp
- name: home
mountPath: /home/nonroot
volumes:
- name: tmp
emptyDir: {}
- name: home
emptyDir: {}
imagePullSecrets:
- name: regcred
backoffLimit: 1