2026-09-13 21:12:15 +09:00
|
|
|
# Tekton Integration Tests
|
2026-09-13 14:28:51 +09:00
|
|
|
|
2026-09-13 21:12:15 +09:00
|
|
|
Curl-based integration tests for the API gateway, orchestrated by Tekton.
|
2026-09-13 14:28:51 +09:00
|
|
|
|
2026-09-13 21:12:15 +09:00
|
|
|
## How It Works
|
2026-09-13 14:28:51 +09:00
|
|
|
|
|
|
|
|
```
|
2026-09-13 21:12:15 +09:00
|
|
|
CI pushes image:sha → creates PipelineRun → Tekton spins up gateway sidecar
|
|
|
|
|
→ runs curl tests → reports pass/fail → CI promotes to :latest if pass
|
2026-09-13 14:28:51 +09:00
|
|
|
```
|
|
|
|
|
|
2026-09-13 21:12:15 +09:00
|
|
|
The Task runs the gateway image as a **sidecar** (same pod, localhost),
|
|
|
|
|
then executes `scripts/integration-test.sh` which tests every adapter
|
|
|
|
|
via `X-Service` + `X-Resource` header routing.
|
2026-09-13 14:28:51 +09:00
|
|
|
|
2026-09-13 21:12:15 +09:00
|
|
|
## Files
|
2026-09-13 14:28:51 +09:00
|
|
|
|
2026-09-13 21:12:15 +09:00
|
|
|
| File | Purpose |
|
|
|
|
|
|------|---------|
|
|
|
|
|
| `task-integration-test.yaml` | Task: sidecar gateway + curl test step |
|
|
|
|
|
| `pipeline-integration-test.yaml` | Pipeline: wraps the Task |
|
|
|
|
|
| `scripts/integration-test.sh` | Test script (mounted as ConfigMap) |
|
|
|
|
|
| `kustomization.yaml` | Generates ConfigMap from script |
|
2026-09-13 14:28:51 +09:00
|
|
|
|
2026-09-13 21:12:15 +09:00
|
|
|
## Manual Run
|
2026-09-13 14:28:51 +09:00
|
|
|
|
|
|
|
|
```bash
|
2026-09-13 21:12:15 +09:00
|
|
|
kubectl apply -k k8s/tekton/
|
|
|
|
|
kubectl create -f - <<'EOF'
|
2026-09-13 14:28:51 +09:00
|
|
|
apiVersion: tekton.dev/v1
|
|
|
|
|
kind: PipelineRun
|
|
|
|
|
metadata:
|
|
|
|
|
name: integration-test-manual
|
|
|
|
|
namespace: api
|
|
|
|
|
spec:
|
|
|
|
|
pipelineRef:
|
|
|
|
|
name: integration-test-pipeline
|
|
|
|
|
params:
|
|
|
|
|
- name: image
|
2026-09-13 21:12:15 +09:00
|
|
|
value: forgejo.riotpiao.com/rock/api-gateway:latest
|
|
|
|
|
EOF
|
2026-09-13 14:28:51 +09:00
|
|
|
|
2026-09-13 21:12:15 +09:00
|
|
|
# Watch
|
|
|
|
|
kubectl logs -f -n api pipelinerun/integration-test-manual -c step-run-tests
|
2026-09-13 14:28:51 +09:00
|
|
|
```
|
|
|
|
|
|
2026-09-13 21:12:15 +09:00
|
|
|
## Updating Tests
|
2026-09-13 14:28:51 +09:00
|
|
|
|
2026-09-13 21:12:15 +09:00
|
|
|
Edit `scripts/integration-test.sh`, then:
|
2026-09-13 14:28:51 +09:00
|
|
|
|
|
|
|
|
```bash
|
2026-09-13 21:12:15 +09:00
|
|
|
kubectl apply -k k8s/tekton/ # recreates ConfigMap
|
2026-09-13 14:28:51 +09:00
|
|
|
```
|
|
|
|
|
|
2026-09-13 21:12:15 +09:00
|
|
|
## Tekton Infrastructure
|
2026-09-13 14:28:51 +09:00
|
|
|
|
2026-09-13 21:12:15 +09:00
|
|
|
Tekton Pipelines is installed in `~/workplace/homelab` via ArgoCD
|
|
|
|
|
(`k8s/argocd/apps/06-ci-cd.yaml` → vendored `k8s/infra/tekton/release.yaml`).
|