-
Notifications
You must be signed in to change notification settings - Fork 541
409 lines (348 loc) · 13 KB
/
complete-testing.yml
File metadata and controls
409 lines (348 loc) · 13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
name: Complete Testing Pipeline
on:
push:
branches: [ main, release-*, feature/all-dev* ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 2 * * *' # Nightly at 2 AM UTC
workflow_dispatch:
inputs:
run_chaos_tests:
description: 'Run chaos tests'
required: false
default: 'false'
type: choice
options:
- 'true'
- 'false'
env:
GO_VERSION: '1.23'
KIND_VERSION: 'v0.26.0'
CHAOS_MESH_VERSION: 'latest'
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install ZMQ
run: |
sudo apt-get update
sudo apt-get install -y libzmq3-dev pkg-config
- name: Run unit tests
run: |
make test-zmq-coverage
make test-kv-sync
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: unit-test-coverage
path: coverage.out
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install ZMQ
run: |
sudo apt-get update
sudo apt-get install -y libzmq3-dev pkg-config
- name: Run integration tests
run: |
# Run only the kv_event_sync tests (exclude webhook tests that need kubebuilder)
go test -v -tags="zmq" github.com/vllm-project/aibrix/test/integration -run "^Test(PodLifecycle|Configuration|EventFlow|Concurrent|MetricsUpdate|ErrorHandling)"
- name: Generate test report
if: always()
run: |
go install github.com/jstemmer/go-junit-report/v2@latest
go test -v -tags="zmq" github.com/vllm-project/aibrix/test/integration -run "^Test(PodLifecycle|Configuration|EventFlow|Concurrent|MetricsUpdate|ErrorHandling)" 2>&1 | go-junit-report -set-exit-code > integration-test-report.xml
- name: Upload test report
if: always()
uses: actions/upload-artifact@v4
with:
name: integration-test-report
path: integration-test-report.xml
e2e-tests:
name: E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install Kind
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/${{ env.KIND_VERSION }}/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
- name: Create Kind cluster
run: |
kind create cluster --config development/vllm/kind-config.yaml
kubectl cluster-info
- name: Install ZMQ
run: |
sudo apt-get update
sudo apt-get install -y libzmq3-dev pkg-config
- name: Build and load images
run: |
make docker-build-all
echo "Loading controller-manager image..."
kind load docker-image aibrix/controller-manager:nightly
echo "Loading gateway-plugins image..."
kind load docker-image aibrix/gateway-plugins:nightly
echo "Loading metadata-service image..."
kind load docker-image aibrix/metadata-service:nightly
echo "Loading runtime image..."
kind load docker-image aibrix/runtime:nightly
echo "Loading kvcache-watcher image..."
kind load docker-image aibrix/kvcache-watcher:nightly
- name: Deploy AIBrix
run: |
kubectl apply -k config/dependency --server-side
kubectl apply -k config/test
# Wait for Redis to be ready first as it's a dependency for E2E tests
echo "Waiting for Redis to be ready..."
kubectl wait --for=condition=ready pod -l app=redis,role=master -n aibrix-system --timeout=300s
# Wait for controller-manager
kubectl wait --for=condition=ready pod -l control-plane=controller-manager -n aibrix-system --timeout=300s
# Show pod status for debugging
echo "Pod status in aibrix-system namespace:"
kubectl get pods -n aibrix-system
- name: Build mock vLLM image
run: |
cd development/app
docker build -t aibrix/vllm-mock:nightly -f Dockerfile .
# Load image only to worker node where vLLM pods will run
kind load docker-image aibrix/vllm-mock:nightly --nodes kind-worker
cd ../..
- name: Deploy mock workload
run: |
cd development/app
kubectl apply -k config/mock
# Wait for llama2-7b service to be ready
kubectl wait --for=condition=ready pod -l app=mock-llama2-7b --timeout=300s
cd ../..
- name: Setup port-forwarding
run: |
# Setup port-forwarding for services required by E2E tests
echo "Setting up port-forwarding..."
kubectl port-forward svc/llama2-7b 8000:8000 >/tmp/llama-pf.log 2>&1 &
kubectl -n envoy-gateway-system port-forward service/envoy-aibrix-system-aibrix-eg-903790dc 8888:80 >/tmp/envoy-pf.log 2>&1 &
kubectl -n aibrix-system port-forward service/aibrix-redis-master 6379:6379 >/tmp/redis-pf.log 2>&1 &
# Wait for port-forwards to establish
sleep 10
# Test Redis connectivity
echo "Testing Redis connectivity..."
nc -zv 127.0.0.1 6379 || {
echo "ERROR: Cannot connect to Redis on 127.0.0.1:6379"
echo "Redis port-forward log:"
cat /tmp/redis-pf.log || true
exit 1
}
echo "Redis is accessible on 127.0.0.1:6379"
- name: Run E2E tests
run: |
export KUBECONFIG="${HOME}/.kube/config"
# Run KV sync E2E tests from the package to include all helper files
# Use zmq build tag since KV cache functionality requires ZMQ
go test -v -tags="zmq" ./test/e2e -run "TestKVSync" -timeout 30m
- name: Collect logs on failure
if: failure()
run: |
kubectl get pods --all-namespaces
kubectl logs -n aibrix-system -l app.kubernetes.io/name=controller-manager --tail=100
kubectl logs -n kv-sync-test --all-containers=true --tail=100 || true
- name: Cleanup
if: always()
run: |
kind delete cluster
performance-tests:
name: Performance Benchmarks
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install ZMQ
run: |
sudo apt-get update
sudo apt-get install -y libzmq3-dev pkg-config
- name: Download baseline metrics
uses: actions/download-artifact@v4
with:
name: baseline-metrics
path: test/benchmark/
continue-on-error: true
- name: Run performance benchmarks
run: |
cd test/benchmark
go test -bench=. -benchmem -benchtime=10s -count=3 -cpu=1,2,4 -tags="zmq" | tee benchmark-results.txt
- name: Generate benchmark report
run: |
go install golang.org/x/perf/cmd/benchstat@latest
cd test/benchmark
benchstat baseline_metrics.txt benchmark-results.txt > benchmark-comparison.txt || true
- name: Check for performance regression
run: |
cd test/benchmark
go run -tags="zmq" <<'EOF'
package main
import (
"fmt"
"os"
)
func main() {
// Simple regression check - enhance as needed
fmt.Println("Performance regression check passed")
}
EOF
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results-${{ github.sha }}
path: |
test/benchmark/benchmark-results.txt
test/benchmark/benchmark-comparison.txt
- name: Update baseline metrics
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: baseline-metrics
path: test/benchmark/benchmark-results.txt
chaos-tests:
name: Chaos Tests
runs-on: ubuntu-latest
if: |
github.event_name == 'schedule' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_chaos_tests == 'true')
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install Kind
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/${{ env.KIND_VERSION }}/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
- name: Create Kind cluster
run: |
kind create cluster --config development/vllm/kind-config.yaml --name chaos-test
kubectl cluster-info
- name: Install Chaos Mesh
run: |
curl -sSL https://mirrors.chaos-mesh.org/${{ env.CHAOS_MESH_VERSION }}/install.sh | bash
kubectl wait --for=condition=ready pod -l app.kubernetes.io/component=controller-manager -n chaos-mesh --timeout=300s
- name: Install ZMQ
run: |
sudo apt-get update
sudo apt-get install -y libzmq3-dev pkg-config
- name: Build and deploy test environment
run: |
make docker-build-all
kind load docker-image aibrix/controller-manager:nightly --name chaos-test
kind load docker-image aibrix/gateway-plugins:nightly --name chaos-test
kind load docker-image aibrix/vllm-mock:nightly --name chaos-test
kubectl apply -k config/dependency --server-side
kubectl apply -k config/test
- name: Run chaos tests
run: |
export KUBECONFIG="${HOME}/.kube/config"
go test -v ./test/chaos/ -timeout 45m
- name: Collect chaos test results
if: always()
run: |
kubectl get chaosengine --all-namespaces
kubectl logs -n chaos-mesh -l app.kubernetes.io/component=controller-manager --tail=100
- name: Cleanup
if: always()
run: |
kind delete cluster --name chaos-test
test-report:
name: Generate Test Report
runs-on: ubuntu-latest
needs: [unit-tests, integration-tests, e2e-tests]
if: always()
steps:
- uses: actions/checkout@v4
- name: Download test artifacts
uses: actions/download-artifact@v4
with:
path: test-artifacts
- name: Generate consolidated report
run: |
echo "# Test Results Summary" > test-report.md
echo "" >> test-report.md
echo "## Unit Tests" >> test-report.md
if [ -f test-artifacts/unit-test-coverage/coverage.out ]; then
echo "✅ Unit tests completed" >> test-report.md
go tool cover -func=test-artifacts/unit-test-coverage/coverage.out | tail -1 >> test-report.md
else
echo "❌ Unit tests failed or did not produce coverage" >> test-report.md
fi
echo "" >> test-report.md
echo "## Integration Tests" >> test-report.md
if [ -f test-artifacts/integration-test-report/integration-test-report.xml ]; then
echo "✅ Integration tests completed" >> test-report.md
else
echo "❌ Integration tests failed" >> test-report.md
fi
echo "" >> test-report.md
echo "## E2E Tests" >> test-report.md
echo "Status based on job result" >> test-report.md
echo "" >> test-report.md
cat test-report.md
- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: test-report
path: test-report.md
- name: Comment PR with test results
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const report = fs.readFileSync('test-report.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: report
});
notify-results:
name: Notify Results
runs-on: ubuntu-latest
needs: [unit-tests, integration-tests, e2e-tests, performance-tests, chaos-tests]
if: always() && github.event_name == 'schedule'
steps:
- name: Determine status
id: status
run: |
if [ "${{ needs.unit-tests.result }}" != "success" ] || \
[ "${{ needs.integration-tests.result }}" != "success" ] || \
[ "${{ needs.e2e-tests.result }}" != "success" ]; then
echo "status=failure" >> $GITHUB_OUTPUT
else
echo "status=success" >> $GITHUB_OUTPUT
fi
- name: Notify on failure
if: steps.status.outputs.status == 'failure'
run: |
echo "Tests failed! Notification would be sent here."
# Add Slack/email notification logic here