Skip to content

Commit 2506f8d

Browse files
committed
update
Signed-off-by: bitliu <[email protected]>
1 parent bf3ce87 commit 2506f8d

File tree

10 files changed

+1512
-230
lines changed

10 files changed

+1512
-230
lines changed

.github/workflows/integration-test-k8s.yml

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
run: |
6262
make build-e2e
6363
64-
- name: Run AI Gateway E2E tests
64+
- name: Run Integration E2E tests
6565
id: e2e-test
6666
run: |
6767
set +e # Don't exit on error, we want to capture the result
@@ -81,6 +81,7 @@ jobs:
8181
path: |
8282
test-report.json
8383
test-report.md
84+
semantic-router-logs.txt
8485
retention-days: 30
8586

8687
- name: Create test summary from report
@@ -90,6 +91,40 @@ jobs:
9091
echo "=== Reading test report from test-report.md ==="
9192
cat test-report.md >> $GITHUB_STEP_SUMMARY
9293
94+
# Add semantic-router logs section if available
95+
if [ -f "semantic-router-logs.txt" ]; then
96+
cat >> $GITHUB_STEP_SUMMARY << 'EOF'
97+
98+
---
99+
100+
### 📝 Semantic Router Logs
101+
102+
<details>
103+
<summary>Click to view semantic-router logs</summary>
104+
105+
```
106+
EOF
107+
# Add first 500 lines of logs to summary (to avoid exceeding GitHub limits)
108+
head -n 500 semantic-router-logs.txt >> $GITHUB_STEP_SUMMARY
109+
110+
# Check if there are more lines
111+
TOTAL_LINES=$(wc -l < semantic-router-logs.txt)
112+
if [ "$TOTAL_LINES" -gt 500 ]; then
113+
cat >> $GITHUB_STEP_SUMMARY << EOF
114+
115+
... (showing first 500 lines of $TOTAL_LINES total lines)
116+
117+
📦 Full logs are available in the workflow artifacts: semantic-router-logs.txt
118+
EOF
119+
fi
120+
121+
cat >> $GITHUB_STEP_SUMMARY << 'EOF'
122+
```
123+
124+
</details>
125+
EOF
126+
fi
127+
93128
# Add additional context
94129
cat >> $GITHUB_STEP_SUMMARY << 'EOF'
95130
@@ -104,10 +139,12 @@ jobs:
104139
- [E2E Test Framework Documentation](https://github.com/${{ github.repository }}/tree/main/e2e)
105140
- [AI Gateway Profile](https://github.com/${{ github.repository }}/tree/main/e2e/profiles/ai-gateway)
106141
107-
### Artifacts
142+
### 📦 Artifacts
108143
109-
- Test reports (JSON and Markdown) are available as workflow artifacts
110-
- Reports are retained for 30 days
144+
- **test-report.json** - Detailed test results in JSON format
145+
- **test-report.md** - Human-readable test report
146+
- **semantic-router-logs.txt** - Complete semantic-router pod logs
147+
- All artifacts are retained for 30 days
111148
EOF
112149
else
113150
echo "⚠️ Test report file not found!" >> $GITHUB_STEP_SUMMARY

e2e/pkg/framework/runner.go

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package framework
33
import (
44
"context"
55
"fmt"
6+
"io"
7+
"os"
68
"strings"
79
"sync"
810
"time"
@@ -163,6 +165,12 @@ func (r *Runner) Run(ctx context.Context) error {
163165
}
164166
}
165167

168+
// Step 7: Collect semantic-router logs (always, regardless of test result)
169+
r.log("📝 Collecting semantic-router logs...")
170+
if err := r.collectSemanticRouterLogs(ctx, kubeClient); err != nil {
171+
r.log("Warning: failed to collect semantic-router logs: %v", err)
172+
}
173+
166174
if hasFailures {
167175
exitCode = 1
168176
r.log("❌ Some tests failed, printing all pods status for debugging...")
@@ -387,6 +395,79 @@ func (r *Runner) printAllPodsDebugInfo(ctx context.Context, client *kubernetes.C
387395
fmt.Printf("\n")
388396
}
389397

398+
// collectSemanticRouterLogs collects logs from semantic-router pods and saves to file
399+
func (r *Runner) collectSemanticRouterLogs(ctx context.Context, client *kubernetes.Clientset) error {
400+
// Find semantic-router pods
401+
pods, err := client.CoreV1().Pods("vllm-semantic-router-system").List(ctx, metav1.ListOptions{})
402+
if err != nil {
403+
return fmt.Errorf("failed to list semantic-router pods: %w", err)
404+
}
405+
406+
if len(pods.Items) == 0 {
407+
r.log("Warning: no semantic-router pods found")
408+
return nil
409+
}
410+
411+
// Collect logs from all semantic-router pods
412+
var allLogs strings.Builder
413+
allLogs.WriteString("========================================\n")
414+
allLogs.WriteString("Semantic Router Logs\n")
415+
allLogs.WriteString("========================================\n\n")
416+
417+
for _, pod := range pods.Items {
418+
allLogs.WriteString(fmt.Sprintf("=== Pod: %s (Namespace: %s) ===\n", pod.Name, pod.Namespace))
419+
allLogs.WriteString(fmt.Sprintf("Status: %s\n", pod.Status.Phase))
420+
allLogs.WriteString(fmt.Sprintf("Node: %s\n", pod.Spec.NodeName))
421+
if pod.Status.StartTime != nil {
422+
allLogs.WriteString(fmt.Sprintf("Started: %s\n", pod.Status.StartTime.Format(time.RFC3339)))
423+
}
424+
allLogs.WriteString("\n")
425+
426+
// Collect logs from all containers in the pod
427+
for _, container := range pod.Spec.Containers {
428+
allLogs.WriteString(fmt.Sprintf("--- Container: %s ---\n", container.Name))
429+
430+
logOptions := &corev1.PodLogOptions{
431+
Container: container.Name,
432+
}
433+
434+
req := client.CoreV1().Pods(pod.Namespace).GetLogs(pod.Name, logOptions)
435+
logs, err := req.Stream(ctx)
436+
if err != nil {
437+
allLogs.WriteString(fmt.Sprintf("Error getting logs: %v\n", err))
438+
continue
439+
}
440+
441+
logBytes, err := io.ReadAll(logs)
442+
logs.Close()
443+
if err != nil {
444+
allLogs.WriteString(fmt.Sprintf("Error reading logs: %v\n", err))
445+
continue
446+
}
447+
448+
if len(logBytes) == 0 {
449+
allLogs.WriteString("(no logs available)\n")
450+
} else {
451+
allLogs.Write(logBytes)
452+
allLogs.WriteString("\n")
453+
}
454+
455+
allLogs.WriteString("\n")
456+
}
457+
458+
allLogs.WriteString("\n")
459+
}
460+
461+
// Write logs to file
462+
logFilename := "semantic-router-logs.txt"
463+
if err := os.WriteFile(logFilename, []byte(allLogs.String()), 0644); err != nil {
464+
return fmt.Errorf("failed to write log file: %w", err)
465+
}
466+
467+
r.log("✅ Semantic router logs saved to: %s", logFilename)
468+
return nil
469+
}
470+
390471
func getPodReadyStatus(pod corev1.Pod) string {
391472
readyCount := 0
392473
totalCount := len(pod.Status.ContainerStatuses)

0 commit comments

Comments
 (0)