Wire node memory and shard slot capabilities
This commit is contained in:
@@ -442,6 +442,7 @@ def test_public_https_tracker_infers_relay_when_network_map_omits_relay_url(
|
||||
def test_real_model_startup_summary_shows_total_layers(tmp_path, monkeypatch, capsys):
|
||||
"""Real-model startup summary prints the shard range plus total model layers."""
|
||||
import meshnet_node.startup as startup_mod
|
||||
captured_registration = {}
|
||||
|
||||
class FakeBackend:
|
||||
total_layers = 24
|
||||
@@ -465,7 +466,9 @@ def test_real_model_startup_summary_shows_total_layers(tmp_path, monkeypatch, ca
|
||||
monkeypatch.setattr(
|
||||
startup_mod,
|
||||
"_post_json",
|
||||
lambda _url, _payload, timeout=10.0: {"node_id": "node-test-123"},
|
||||
lambda _url, _payload, timeout=10.0: (
|
||||
captured_registration.update(_payload) or {"node_id": "node-test-123"}
|
||||
),
|
||||
)
|
||||
|
||||
node = run_startup(
|
||||
@@ -473,11 +476,15 @@ def test_real_model_startup_summary_shows_total_layers(tmp_path, monkeypatch, ca
|
||||
model_id="Qwen/Qwen2.5-0.5B-Instruct",
|
||||
shard_start=0,
|
||||
shard_end=23,
|
||||
vram_mb_override=6144,
|
||||
max_loaded_shards=2,
|
||||
wallet_path=tmp_path / "wallet.json",
|
||||
)
|
||||
|
||||
assert node.backend.total_layers == 24
|
||||
assert node.tracker_node_id == "node-test-123"
|
||||
assert captured_registration["vram_bytes"] == 6144 * 1024 * 1024
|
||||
assert captured_registration["max_loaded_shards"] == 2
|
||||
output = capsys.readouterr().out
|
||||
assert "Shard: layers 0–23; 24 of 24" in output
|
||||
assert "Node ID: node-test-123" in output
|
||||
|
||||
@@ -845,6 +845,25 @@ def test_tracker_registration_rejects_invalid_payload():
|
||||
tracker.stop()
|
||||
|
||||
|
||||
def test_tracker_registration_rejects_invalid_max_loaded_shards():
|
||||
tracker = TrackerServer()
|
||||
tracker_port = tracker.start()
|
||||
try:
|
||||
try:
|
||||
_post_json(
|
||||
f"http://127.0.0.1:{tracker_port}/v1/nodes/register",
|
||||
{"endpoint": "http://127.0.0.1:9001", "shard_start": 0, "shard_end": 31,
|
||||
"max_loaded_shards": 0, "hardware_profile": {}, "score": 1.0},
|
||||
)
|
||||
raise AssertionError("Expected 400 for invalid max_loaded_shards")
|
||||
except urllib.error.HTTPError as exc:
|
||||
assert exc.code == 400
|
||||
body = json.loads(exc.read())
|
||||
assert "capability values" in body["error"]
|
||||
finally:
|
||||
tracker.stop()
|
||||
|
||||
|
||||
def test_tracker_routes_only_nodes_for_requested_model():
|
||||
"""A node registered for one model cannot satisfy another model's route."""
|
||||
tracker = TrackerServer(model_presets={
|
||||
|
||||
Reference in New Issue
Block a user