- Removed references to llamacpp from configuration files, scripts, and documentation, streamlining the LLM setup process to focus solely on Ollama. - Updated environment variables and paths to eliminate llamacpp-related entries, ensuring clarity in the configuration. - Adjusted CLI commands and help messages to reflect the removal of llamacpp, enhancing user experience and reducing confusion. - Revised documentation to provide clear guidance on using Ollama exclusively, including updates to setup instructions and runtime options.
73 lines
2.0 KiB
Python
73 lines
2.0 KiB
Python
from gpu_rent.tunnel import decide_watch, tunnel_forwards
|
|
|
|
|
|
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"
|
|
|
|
|
|
def test_tunnel_forwards_swarm_only(monkeypatch):
|
|
class Cfg:
|
|
swarmui_local_port = 17801
|
|
llm_runtime = "none"
|
|
ollama_local_port = 17811
|
|
|
|
monkeypatch.setattr("gpu_rent.tunnel.load_state", lambda: type("S", (), {"notes": {}})())
|
|
assert tunnel_forwards(Cfg()) == [(17801, 7801)]
|
|
|
|
|
|
def test_tunnel_forwards_prefers_cfg_over_stale_notes(monkeypatch):
|
|
class Cfg:
|
|
swarmui_local_port = 17801
|
|
llm_runtime = "none"
|
|
ollama_local_port = 17811
|
|
|
|
monkeypatch.setattr(
|
|
"gpu_rent.tunnel.load_state",
|
|
lambda: type("S", (), {"notes": {"llm_runtime": "ollama"}})(),
|
|
)
|
|
assert tunnel_forwards(Cfg()) == [(17801, 7801)]
|
|
|
|
|
|
def test_resolve_llm_notes_only_when_cfg_none(monkeypatch):
|
|
from gpu_rent.access_card import resolve_llm_runtime
|
|
|
|
class Cfg:
|
|
llm_runtime = "none"
|
|
|
|
monkeypatch.setattr(
|
|
"gpu_rent.access_card.load_state",
|
|
lambda: type("S", (), {"notes": {"llm_runtime": "ollama"}})(),
|
|
)
|
|
assert resolve_llm_runtime(Cfg()) == "ollama"
|
|
|
|
class Cfg2:
|
|
llm_runtime = "ollama"
|
|
|
|
monkeypatch.setattr(
|
|
"gpu_rent.access_card.load_state",
|
|
lambda: type("S", (), {"notes": {"llm_runtime": "none"}})(),
|
|
)
|
|
assert resolve_llm_runtime(Cfg2()) == "ollama"
|