34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
import sys
|
|
import os
|
|
import json
|
|
import time
|
|
|
|
sys.path.append("/Users/adolforeyna/Projects/PiZeroNoteKeeper")
|
|
from kernel.system import SystemContext
|
|
|
|
def run_test():
|
|
context = SystemContext(target_ip="127.0.0.1", target_port=8081, pin_target=True)
|
|
# Start with wrong port (80 instead of 8080) to force fallback
|
|
context.mcp_port = 80
|
|
|
|
# Clear any initial status message from discovery
|
|
time.sleep(0.5)
|
|
context.status_msg = ""
|
|
|
|
print("Sending play_beep command starting with port 80...")
|
|
context.play_beep(frequency=1200, duration_ms=40, volume=30)
|
|
|
|
# Wait for fallback to execute (requires timeout retry)
|
|
time.sleep(2.0)
|
|
|
|
# Verify fallback succeeded and updated port to 8080
|
|
if context.mcp_port == 8080:
|
|
print("SUCCESS: Fallback automatically corrected mcp_port to 8080!")
|
|
else:
|
|
print("FAIL: Fallback did not correct port. Current port: {}, status: '{}'".format(context.mcp_port, context.status_msg))
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
run_test()
|