new tasks, model pricing, auto quantisation, etc...
This commit is contained in:
@@ -388,6 +388,48 @@ def test_legacy_start_treats_repo_model_as_model_id(monkeypatch):
|
||||
assert captured["model_id"] == "Qwen/Qwen2.5-0.5B-Instruct"
|
||||
|
||||
|
||||
def test_legacy_start_falls_back_to_env_tracker_and_model(monkeypatch):
|
||||
"""`meshnet-node start` uses env defaults when tracker/model flags are omitted."""
|
||||
import importlib
|
||||
|
||||
from meshnet_node import config as config_mod
|
||||
from meshnet_node.cli import main
|
||||
|
||||
monkeypatch.setenv("MESHNET_TRACKER_URL", "http://env-tracker:8081")
|
||||
monkeypatch.setenv("MESHNET_MODEL", "Qwen/Qwen2.5-0.5B-Instruct")
|
||||
importlib.reload(config_mod)
|
||||
|
||||
captured = {}
|
||||
|
||||
def fake_run_startup(*args, **kwargs):
|
||||
captured.update(kwargs)
|
||||
class _FakeNode:
|
||||
chat_completion_count = 0
|
||||
def stop(self): pass
|
||||
return _FakeNode()
|
||||
|
||||
monkeypatch.setattr(sys, "argv", [
|
||||
"meshnet-node", "start",
|
||||
"--port", "0",
|
||||
])
|
||||
|
||||
try:
|
||||
with patch("meshnet_node.startup.run_startup", side_effect=fake_run_startup):
|
||||
with patch("time.sleep", side_effect=KeyboardInterrupt):
|
||||
try:
|
||||
main()
|
||||
except SystemExit as exc:
|
||||
assert exc.code == 0
|
||||
finally:
|
||||
monkeypatch.delenv("MESHNET_TRACKER_URL", raising=False)
|
||||
monkeypatch.delenv("MESHNET_MODEL", raising=False)
|
||||
importlib.reload(config_mod)
|
||||
|
||||
assert captured["tracker_url"] == "http://env-tracker:8081"
|
||||
assert captured["model"] == "Qwen2.5-0.5B-Instruct"
|
||||
assert captured["model_id"] == "Qwen/Qwen2.5-0.5B-Instruct"
|
||||
|
||||
|
||||
def test_legacy_start_without_port_uses_next_available_port(monkeypatch):
|
||||
"""Omitting --port skips an occupied default port before startup loads the model."""
|
||||
from meshnet_node.cli import main
|
||||
|
||||
Reference in New Issue
Block a user