Skip to content

Commit 5ae40a4

Browse files
committed
tests now use the aggregator cluster
1 parent e7180c4 commit 5ae40a4

6 files changed

Lines changed: 92 additions & 193 deletions

File tree

.github/workflows/integration-tests.yml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ jobs:
123123
fi
124124
done
125125
shell: bash
126+
shell: bash
127+
shell: bash
126128
timeout-minutes: 20
127129

128130
- name: Load images into Kind (Windows)
@@ -132,21 +134,57 @@ jobs:
132134
$name = $_.Name
133135
Write-Host "Loading $name into kind..."
134136
kind load docker-image "${name}:latest" --name aggregator-test
135-
}
137+
kind load docker-image "${name}:latest" --name aggregator
136138
shell: powershell
137139
timeout-minutes: 20
138140

139141
- name: Wait for cluster to be ready
140-
run: |
142+
- name: Generate key pair for UMA proxy
141143
kubectl config use-context kind-aggregator-test
142-
kubectl wait --for=condition=Ready nodes --all --timeout=120s
144+
kubectl config use-context kind-aggregator
143145
shell: bash
144-
146+
openssl genrsa -out uma-proxy.key 4096
147+
openssl req -x509 -new -nodes -key uma-proxy.key -sha256 -days 3650 -out uma-proxy.crt -subj "/CN=Aggregator MITM CA"
148+
kubectl delete secret uma-proxy-key-pair -n default --ignore-not-found
149+
kubectl create secret generic uma-proxy-key-pair --from-file=uma-proxy.crt=uma-proxy.crt --from-file=uma-proxy.key=uma-proxy.key -n default
150+
rm uma-proxy.crt uma-proxy.key
151+
152+
- name: Deploy aggregator-cleaner
153+
run: |
154+
kubectl apply -f k8s/ops/ns.yaml
155+
kubectl apply -f k8s/ops/cleaner.yaml
156+
kubectl wait --namespace aggregator-ops --for=condition=available deployment/aggregator-cleaner --timeout=60s || true
157+
158+
- name: Deploy Traefik
159+
run: |
160+
helm repo add traefik https://traefik.github.io/charts
161+
helm repo update
162+
kind export logs ./kind-logs --name aggregator || true
163+
--namespace aggregator-traefik \
164+
--create-namespace \
165+
--set ingressClass.enabled=true \
166+
--set ingressClass.name=aggregator-traefik \
167+
--set ports.web.hostPort=80 \
168+
--set ports.websecure.hostPort=443 \
169+
--set service.type=ClusterIP \
170+
--set providers.kubernetesCRD.allowCrossNamespace=true \
171+
kind export logs ./kind-logs --name aggregator
172+
kubectl rollout status deployment aggregator-traefik -n aggregator-traefik --timeout=180s
173+
174+
- name: Deploy aggregator
175+
run: |
176+
kubectl apply -f k8s/app/ns.yaml
177+
kubectl apply -f k8s/app/config.yaml
178+
kubectl apply -f k8s/app/aggregator.yaml
179+
kubectl rollout status deployment aggregator-server -n aggregator-app --timeout=120s
180+
181+
- name: Add /etc/hosts entry
182+
run: |
183+
echo "127.0.0.1 aggregator.local" | sudo tee -a /etc/hosts
145184
- name: Run integration tests
146185
run: |
147186
cd integration-test
148-
go test -v -timeout 30m ./...
149-
shell: bash
187+
kind delete cluster --name aggregator || true
150188
timeout-minutes: 35
151189

152190
- name: Collect logs on failure (Linux)

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,31 @@ Automated tests run on GitHub Actions for Linux and Windows on every push and pu
160160

161161
### Run Locally
162162

163+
Integration tests use the existing Kind cluster and deployment created by `make kind-init` and `make deploy`.
164+
163165
```bash
166+
# First-time setup
167+
make kind-init
168+
make deploy
169+
170+
# Run tests (uses existing cluster)
164171
make integration-test
165172
```
166173

167-
Tests use port forwarding to `localhost:8080` to avoid requiring root privileges.
174+
The tests will:
175+
- Verify the existing `aggregator` cluster is running
176+
- Check that the aggregator is deployed
177+
- Run all integration tests against `http://aggregator.local`
178+
- Leave the cluster running after tests complete
179+
180+
### CI/CD
181+
182+
The GitHub Actions workflow automatically:
183+
1. Creates a test cluster
184+
2. Builds and loads containers
185+
3. Deploys Traefik and the aggregator
186+
4. Runs the full test suite
187+
5. Cleans up the test cluster
168188

169189
## Troubleshooting
170190

integration-test/kind-test-config.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

integration-test/main_test.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
var testEnv *utils.TestEnvironment
1313

1414
func TestMain(m *testing.M) {
15-
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
15+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
1616
defer cancel()
1717

1818
var err error
@@ -21,14 +21,6 @@ func TestMain(m *testing.M) {
2121
panic("Failed to setup test environment: " + err.Error())
2222
}
2323

24-
if err := testEnv.WaitForAggregatorReady(ctx); err != nil {
25-
panic("Aggregator not ready: " + err.Error())
26-
}
27-
28-
if err := testEnv.SetupPortForward(ctx); err != nil {
29-
panic("Failed to setup port forward: " + err.Error())
30-
}
31-
3224
code := m.Run()
3325

3426
if err := testEnv.Cleanup(); err != nil {

integration-test/server_metadata_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ func TestClientIdentifierDocument(t *testing.T) {
8080
t.Fatal("client_identifier field missing or not a string")
8181
}
8282

83-
// 2. GET the client identifier document
8483
clientResp, err := http.Get(clientIdentifierURL)
8584
if err != nil {
8685
t.Fatalf("Failed to get client identifier document: %v", err)

0 commit comments

Comments
 (0)