/ src / connectivity_test.py
connectivity_test.py
 1  import subprocess
 2  import sys
 3  
 4  def test_radicle():
 5      print("[CHECK] Testing Radicle...")
 6      try:
 7          result = subprocess.run(["rad", "node", "status"], capture_output=True, text=True)
 8          if "running" in result.stdout:
 9              print("  ✓ Radicle Node is running.")
10              return True
11          else:
12              print("  ✗ Radicle Node is not running properly.")
13              return False
14      except Exception as e:
15          print(f"  ✗ Radicle Error: {e}")
16          return False
17  
18  def test_ipfs():
19      print("[CHECK] Testing IPFS...")
20      try:
21          result = subprocess.run(["ipfs", "id"], capture_output=True, text=True)
22          if result.returncode == 0:
23              print("  ✓ IPFS Daemon is reachable.")
24              return True
25          else:
26              print("  ✗ IPFS Daemon is unreachable.")
27              return False
28      except Exception as e:
29          print(f"  ✗ IPFS Error: {e}")
30          return False
31  
32  if __name__ == "__main__":
33      r = test_radicle()
34      i = test_ipfs()
35      if r and i:
36          print("\n[ENVOY] Stack Connectivity Verified.")
37          sys.exit(0)
38      else:
39          print("\n[ENVOY] Stack Connectivity FAILED.")
40          sys.exit(1)