File size: 937 Bytes
bbd5f9c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
import subprocess
import time
import requests
import os

# Start the server in the background
print("Starting server...")
server_process = subprocess.Popen(
    ["python3", "app.py"], 
    env={**os.environ, "PORT": "8004"},
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE
)

# Wait for server to start
time.sleep(5)

try:
    # Test health endpoint
    response = requests.get("http://localhost:8004/health", timeout=10)
    print(f"Health check status: {response.status_code}")
    print(f"Health response: {response.json()}")
    
    # Test root endpoint
    response = requests.get("http://localhost:8004/", timeout=10)
    print(f"Root status: {response.status_code}")
    print(f"Root response: {response.json()}")
    
except Exception as e:
    print(f"Error testing server: {e}")

finally:
    # Stop the server
    server_process.terminate()
    server_process.wait()
    print("Server stopped")