-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_deployment.py
More file actions
84 lines (75 loc) · 2.65 KB
/
Copy pathtest_deployment.py
File metadata and controls
84 lines (75 loc) · 2.65 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
#!/usr/bin/env python3
"""
Test if DELTA backend is deployed and working
"""
import requests
import time
import json
BACKEND_URL = "https://delta-backend-zom0.onrender.com"
def test_backend():
print("🧪 Testing DELTA Backend Deployment")
print("=" * 40)
# Test 1: Health check
print(f"\n1. Testing backend health at {BACKEND_URL}...")
try:
response = requests.get(f"{BACKEND_URL}/", timeout=10)
if response.status_code == 200:
print("✅ Backend is responding")
else:
print(f"❌ Backend returned status {response.status_code}")
return False
except Exception as e:
print(f"❌ Backend not responding: {e}")
return False
# Test 2: TTS endpoint
print("\n2. Testing TTS endpoint...")
try:
response = requests.post(
f"{BACKEND_URL}/tts",
json={"text": "Hello, I am DELTA!"},
timeout=30
)
if response.status_code == 200:
data = response.json()
if "audioContent" in data:
print("✅ TTS endpoint working")
else:
print("❌ TTS endpoint not returning audio")
else:
print(f"❌ TTS endpoint returned status {response.status_code}")
except Exception as e:
print(f"❌ TTS endpoint failed: {e}")
# Test 3: Chat endpoint
print("\n3. Testing chat endpoint...")
try:
response = requests.post(
f"{BACKEND_URL}/learn",
json={"user_input": "Hello DELTA, say hi!"},
timeout=30
)
if response.status_code == 200:
data = response.json()
if "response" in data:
print("✅ Chat endpoint working")
print(f" Response: {data['response'][:50]}...")
else:
print("❌ Chat endpoint not returning response")
else:
print(f"❌ Chat endpoint returned status {response.status_code}")
except Exception as e:
print(f"❌ Chat endpoint failed: {e}")
print(f"\n🎉 Backend test complete!")
print(f"🌐 Frontend should now work at: https://darriey.github.io/DELTA_2.0/")
return True
if __name__ == "__main__":
print("⏳ Waiting for deployment to complete...")
time.sleep(30) # Give deployment time to start
for attempt in range(5):
print(f"\n🔄 Attempt {attempt + 1}/5")
if test_backend():
break
if attempt < 4:
print("⏳ Waiting 30 seconds before retry...")
time.sleep(30)
else:
print("\n❌ Backend deployment may have failed. Check Render dashboard.")