story: DGR-037 Bind llama.cpp to the standalone worker
This commit is contained in:
46
tests/test_llama_shard_worker_binding.py
Normal file
46
tests/test_llama_shard_worker_binding.py
Normal file
@@ -0,0 +1,46 @@
|
||||
"""DGR-037 structural guardrails for the standalone llama.cpp worker.
|
||||
|
||||
The real GGUF lane is opt-in and needs a mounted artifact; these tests keep the
|
||||
default suite model-download-free while guarding the integration shape that a
|
||||
later real-model harness exercises.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
WORKER = ROOT / "packages/node/native/worker"
|
||||
|
||||
|
||||
def test_worker_uses_the_private_llama_shardengine_not_the_fixture_engine():
|
||||
service_header = (WORKER / "shard_service.h").read_text(encoding="utf-8")
|
||||
service = (WORKER / "shard_service.cpp").read_text(encoding="utf-8")
|
||||
engine = (WORKER / "llama_shard_engine.cpp").read_text(encoding="utf-8")
|
||||
assert '#include "llama_shard_engine.h"' in service_header
|
||||
assert "FakeShardEngine" not in service_header
|
||||
assert "engine_.Execute(" in service
|
||||
assert "llama_model_load_from_file" in engine
|
||||
assert "llama_model_meshnet_range_report" in engine
|
||||
|
||||
|
||||
def test_worker_configuration_and_death_hook_are_explicit_and_opt_in():
|
||||
main = (WORKER / "shard_worker_main.cpp").read_text(encoding="utf-8")
|
||||
for name in (
|
||||
"MESHNET_MODEL_ARTIFACT",
|
||||
"MESHNET_MODEL_ARTIFACT_DIGEST",
|
||||
"MESHNET_RUNTIME_RECIPE_DIGEST",
|
||||
"MESHNET_SHARD_START_LAYER",
|
||||
"MESHNET_SHARD_END_LAYER",
|
||||
"MESHNET_INJECT_PROCESS_DEATH_AFTER_EXECUTIONS",
|
||||
):
|
||||
assert name in main
|
||||
assert "engine->Shutdown()" in main
|
||||
|
||||
|
||||
def test_identity_is_loaded_not_stream_supplied_and_health_reports_it():
|
||||
source = (WORKER / "shard_service.cpp").read_text(encoding="utf-8")
|
||||
assert "r.start_layer() == engine_.identity().start_layer" in source
|
||||
assert "r.end_layer() == engine_.identity().end_layer" in source
|
||||
assert "model artifact or runtime recipe digest does not match" in source
|
||||
assert "resident_bytes" in source
|
||||
assert '" range=["' in source
|
||||
Reference in New Issue
Block a user