PROTHAM commited on
Commit
8fc7d70
Β·
1 Parent(s): 2969073

chore: add test-all.sh bash script to validate everything at once

Browse files
Files changed (1) hide show
  1. test-all.sh +60 -0
test-all.sh ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ echo "==========================================="
6
+ echo " API Debug Env - Full Validation Pipeline "
7
+ echo "==========================================="
8
+
9
+ echo -e "\n[1/4] Checking Python Syntax & Dependencies..."
10
+ pip install -r requirements.txt || echo "pip install failed"
11
+
12
+ echo -e "\n[2/4] Running 'openenv validate'..."
13
+ openenv validate
14
+ if [ $? -eq 0 ]; then
15
+ echo -e "βœ… openenv validate PASSED!"
16
+ else
17
+ echo -e "❌ openenv validate FAILED!"
18
+ exit 1
19
+ fi
20
+
21
+ echo -e "\n[3/4] Testing Docker Build locally..."
22
+ docker build -t api-debug-env-test .
23
+ if [ $? -eq 0 ]; then
24
+ echo -e "βœ… Docker build PASSED!"
25
+ else
26
+ echo -e "❌ Docker build FAILED!"
27
+ exit 1
28
+ fi
29
+
30
+ echo -e "\n[4/4] Testing inference.py natively..."
31
+ export HF_TOKEN="dummy_token_test"
32
+ export API_BASE_URL="https://router.huggingface.co/v1"
33
+ export MODEL_NAME="mistralai/Mistral-7B-Instruct-v0.3"
34
+
35
+ # Spin up the background server for inference.py to hit
36
+ echo "Starting local FastAPI server on port 7860..."
37
+ uvicorn server.app:app --port 7860 &
38
+ SERVER_PID=$!
39
+
40
+ # Give the server a few seconds to start up
41
+ sleep 3
42
+
43
+ echo "Running inference.py..."
44
+ python inference.py
45
+ INF_EXIT=$?
46
+
47
+ # Kill the background server
48
+ kill $SERVER_PID
49
+
50
+ if [ $INF_EXIT -eq 0 ]; then
51
+ echo -e "βœ… inference.py ran successfully without crashing!"
52
+ else
53
+ echo -e "❌ inference.py FAILED with status $INF_EXIT!"
54
+ exit 1
55
+ fi
56
+
57
+ echo -e "\n==========================================="
58
+ echo " πŸŽ‰ ALL VALIDATION CHECKS PASSED SUCCESSFULLY!"
59
+ echo " Everything is 100% ready for the Meta Hackathon."
60
+ echo "==========================================="