-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_api.sh
More file actions
executable file
·41 lines (32 loc) · 800 Bytes
/
test_api.sh
File metadata and controls
executable file
·41 lines (32 loc) · 800 Bytes
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
#!/bin/bash
# Quick test script for the API
echo "🧪 Testing AI Agriculture Advisor API..."
echo ""
# Check if .env file exists
if [ ! -f .env ]; then
echo "❌ Error: .env file not found!"
echo "Please create a .env file with your GEMINI_API_KEY"
exit 1
fi
# Test environment loading
echo "📋 Testing environment variable loading..."
python3 test_env.py
echo ""
# Start the API in test mode
echo "🚀 Starting API server..."
cd api
python3 main.py &
API_PID=$!
cd ..
# Wait for API to start
echo "⏳ Waiting for API to start..."
sleep 3
# Test health endpoint
echo "🏥 Testing health endpoint..."
curl -s http://localhost:8000/health | python3 -m json.tool
echo ""
# Cleanup
echo ""
echo "🛑 Stopping API server..."
kill $API_PID 2>/dev/null
echo "✅ Test complete!"