-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-phase1-chunking.sh
More file actions
executable file
·68 lines (60 loc) · 1.88 KB
/
test-phase1-chunking.sh
File metadata and controls
executable file
·68 lines (60 loc) · 1.88 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
#!/bin/bash
# Phase 1 Test Script - Smart Chunking
echo "🧪 Testing Phase 1: Smart Log Chunking"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Test log sample with multiple steps
TEST_LOG='##[group]Set up job
Current runner version: '\''2.311.0'\''
Operating System:
Ubuntu 22.04.3
##[endgroup]
##[group]Build Application
Run npm install
npm WARN deprecated package@1.0.0
npm ERR! Cannot find module '\''react'\''
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2024-01-01-debug.log
##[endgroup]
##[group]Run Tests
Run npm test
Test suite failed to run:
AssertionError: expected 5 to equal 6
at Object.\u003canonymous\u003e (test.js:10:20)
##[endgroup]
Post Build Application
Error: exit code 1
'
echo "📝 Test Log (with GitHub Actions markers):"
echo "$TEST_LOG"
echo ""
# Create test endpoint
echo "1️⃣ Testing log parser directly..."
# Test with curl to analyze endpoint
RESPONSE=$(curl -s -X POST http://localhost:3001/api/analyze \
-H "Content-Type: text/plain" \
-d "$TEST_LOG")
if [ $? -eq 0 ]; then
echo "✅ API responded successfully"
echo ""
echo "Response:"
echo "$RESPONSE" | python3 -m json.tool 2>/dev/null || echo "$RESPONSE"
else
echo "❌ API request failed"
exit 1
fi
echo ""
echo "2️⃣ Check database for chunks..."
echo "Run: npm run prisma:studio"
echo "Then check the 'LogChunk' table"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "✅ Phase 1 Test Complete!"
echo ""
echo "Expected results:"
echo "✅ Multiple chunks detected (one per ##[group])"
echo "✅ Errors detected in chunks"
echo "✅ Step names extracted (e.g., 'Build Application', 'Run Tests')"
echo "✅ Token counts calculated"
echo ""
echo "Next: Check Prisma Studio to verify chunks were saved!"