- Updated version number in pyproject.toml and __init__.py to 0.2.0. - Revised README.md to reflect the current state of the project, including usage instructions and setup steps. - Improved CLI documentation in cli.md, adding details about new commands and their functionalities. - Enhanced the quick start section in README.md for better clarity on initial setup. - Updated local folder documentation to clarify file handling and commands. - Added a new command for listing GPU flavors and improved error handling in the CLI. - Implemented a watchdog feature in the tunnel to manage server states effectively.
28 lines
710 B
Python
28 lines
710 B
Python
from gpu_rent.tunnel import decide_watch
|
|
|
|
|
|
def test_decide_ok_active():
|
|
d = decide_watch("ACTIVE", tunnel_alive=True)
|
|
assert d.kind == "ok"
|
|
|
|
|
|
def test_decide_reconnect_when_tunnel_dead():
|
|
d = decide_watch("ACTIVE", tunnel_alive=False)
|
|
assert d.kind == "reconnect"
|
|
|
|
|
|
def test_decide_unshelve_expired():
|
|
for st in ("EXPIRED", "SHELVED", "SHELVED_OFFLOADED"):
|
|
d = decide_watch(st, tunnel_alive=True)
|
|
assert d.kind == "unshelve", st
|
|
|
|
|
|
def test_decide_exit_error():
|
|
d = decide_watch("ERROR", tunnel_alive=True)
|
|
assert d.kind == "exit"
|
|
|
|
|
|
def test_decide_exit_missing():
|
|
d = decide_watch(None, tunnel_alive=False)
|
|
assert d.kind == "exit"
|