Add integration test suite that tests against production cluster: - Memory service (ingest, query) - S3 adapter (list, put objects) - SQS adapter (list queues with auth enforcement) - Workflow adapter (gRPC ListWorkflowExecutions) - IAM adapter (list users) - Health endpoints (liveness, readiness) Update CI/CD pipeline: - Build new docker image from commit - Push to registry with commit SHA and latest tags - Deploy test job to cluster to run integration tests - Tests run against actual production services - Cleanup test resources after completion Add Kubernetes Job manifest: - Runs integration tests in dedicated pod - Waits for gateway to be ready before testing - Tests all adapters and downstream services - Can be run manually: kubectl apply -f k8s/integration-test-job.yaml
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: api-gateway-integration-test
|
||||
namespace: api
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
serviceAccountName: api-gateway
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: integration-tester
|
||||
image: golang:1.26-bookworm
|
||||
imagePullPolicy: IfNotPresent
|
||||
workingDir: /workspace
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
set -e
|
||||
echo "Starting integration tests..."
|
||||
|
||||
# Clone the repo
|
||||
git clone https://forgejo.riotpiao.com/riotpiao-poimen/homelab-frontend.git .
|
||||
|
||||
# Wait for gateway to be ready
|
||||
echo "Waiting for gateway service to be ready..."
|
||||
for i in {1..30}; do
|
||||
if curl -s http://api-gateway:8080/healthz | grep -q "alive"; then
|
||||
echo "✓ Gateway is ready"
|
||||
break
|
||||
fi
|
||||
echo "Attempting to reach 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"
|
||||
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: {}
|
||||
backoffLimit: 1
|
||||
Reference in New Issue
Block a user