-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_deployment.py
More file actions
148 lines (124 loc) · 4.17 KB
/
test_deployment.py
File metadata and controls
148 lines (124 loc) · 4.17 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/env python3
"""
Test script to verify Satoshi's Arcade MCP is ready for deployment
"""
import subprocess
import sys
import os
import requests
import time
import threading
def test_imports():
"""Test that all modules can be imported"""
print("Testing module imports...")
try:
import api.main
print("✅ api.main imported successfully")
except Exception as e:
print(f"❌ api.main import failed: {e}")
return False
try:
import database
print("✅ database imported successfully")
except Exception as e:
print(f"❌ database import failed: {e}")
return False
try:
import ai.difficulty_agent
print("✅ ai.difficulty_agent imported successfully")
except Exception as e:
print(f"❌ ai.difficulty_agent import failed: {e}")
return False
return True
def test_server_startup():
"""Test that the server can start"""
print("\nTesting server startup...")
try:
# Start server in background
process = subprocess.Popen([
sys.executable, "-m", "uvicorn",
"api.main:app",
"--host", "127.0.0.1",
"--port", "8005"
], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Wait for server to start
time.sleep(3)
# Test health endpoint
try:
response = requests.get("http://127.0.0.1:8005/health", timeout=5)
if response.status_code == 200:
print("✅ Health check passed")
health_data = response.json()
print(f" Status: {health_data.get('status')}")
print(f" Games: {health_data.get('games')}")
else:
print(f"❌ Health check failed: {response.status_code}")
return False
except Exception as e:
print(f"❌ Health check error: {e}")
return False
# Test main page
try:
response = requests.get("http://127.0.0.1:8005/", timeout=5)
if response.status_code == 200:
print("✅ Main page loads successfully")
else:
print(f"❌ Main page failed: {response.status_code}")
return False
except Exception as e:
print(f"❌ Main page error: {e}")
return False
# Stop server
process.terminate()
process.wait()
return True
except Exception as e:
print(f"❌ Server startup test failed: {e}")
return False
def test_file_structure():
"""Test that all required files exist"""
print("\nTesting file structure...")
required_files = [
"requirements.txt",
"render.yaml",
"api/main.py",
"database.py",
"ai/difficulty_agent.py",
"frontend/arcade/index.html",
"frontend/pingpong/index.html",
"frontend/tetris/index.html"
]
all_exist = True
for file_path in required_files:
if os.path.exists(file_path):
print(f"✅ {file_path}")
else:
print(f"❌ {file_path} - MISSING")
all_exist = False
return all_exist
def main():
print("🧪 Testing Satoshi's Arcade MCP for deployment")
print("=" * 50)
# Test file structure
if not test_file_structure():
print("\n❌ File structure test failed")
return False
# Test imports
if not test_imports():
print("\n❌ Import test failed")
return False
# Test server startup
if not test_server_startup():
print("\n❌ Server startup test failed")
return False
print("\n🎉 All tests passed! Ready for deployment!")
print("\nNext steps:")
print("1. Go to https://dashboard.render.com")
print("2. Create new Web Service")
print("3. Connect GitHub repository: polydeuces32/satoshis-arcade-mcp")
print("4. Use the settings from DEPLOYMENT_GUIDE.md")
print("5. Deploy and enjoy your live arcade!")
return True
if __name__ == "__main__":
success = main()
sys.exit(0 if success else 1)