Files
serverAppConfigs/tests/frank_large_unit.bats
T

87 lines
3.7 KiB
Bash
Executable File

#!/usr/bin/env bats
# Seam: the frank-large ik_llama.cpp root unit on dankclaw.
# ik_llama.cpp replaced the halogen rootless Quadlet on 2026-09-15. This seam
# pins the deployment-policy properties that no reviewer can see by reading
# the flags alone: a root unit whose files all live in this repo, the hybrid
# placement contract (experts + PLE mmap'd on the CPU path — NEVER the
# CUDA_Host pinned buffer), no pinned CUDA host memory, the single client
# port every consumer already targets, the fleet alias, greedy-by-default
# sampling, vision via the mtmd mmproj, and a deploy handler that retires
# the halogen quadlet without deleting it.
load helpers
UNIT="$REPO_ROOT/scripts/frank-large.service"
SERVE="$REPO_ROOT/scripts/serve-frank-large.sh"
ENV_FILE="$REPO_ROOT/scripts/frank-large.env"
REMOTE_DEPLOY="$REPO_ROOT/scripts/deploy-remote.sh"
@test "frank-large unit, serve script and env exist in scripts/" {
[ -f "$UNIT" ]
[ -f "$SERVE" ]
[ -f "$ENV_FILE" ]
}
@test "frank-large unit is boot-persistent, self-healing and unprivileged" {
grep -q '^WantedBy=multi-user.target$' "$UNIT"
grep -q '^Restart=on-failure$' "$UNIT"
grep -q '^RestartSec=' "$UNIT"
grep -q '^User=dank$' "$UNIT"
grep -q '^LimitMEMLOCK=infinity$' "$UNIT"
}
@test "frank-large unit points at the repo serve script and env" {
grep -q 'ExecStart=/home/dank/serverAppConfigs/scripts/serve-frank-large.sh$' "$UNIT"
grep -q 'FRANK_LARGE_ENV_FILE=/home/dank/serverAppConfigs/scripts/frank-large.env' "$UNIT"
}
@test "frank-large places experts and PLE on the mmap'd CPU path, never the pinned buffer" {
# --cpu-moe routes CPU-overridden weights through the CUDA_Host PINNED
# buffer (108.12 GiB measured on 2026-09-15; it evicted every co-tenant
# into swap and starved sshd into unreachability). The -ot ...=CPU plain
# CPU backend buffer is the mmap-backed path.
grep -q -- '-ot "exps=CPU" -ot "per_layer_token_embd=CPU"' "$SERVE"
grep -q '^GGML_CUDA_NO_PINNED_WEIGHTS=1$' "$ENV_FILE"
# The serve script refuses to run without the no-pinned policy.
grep -q 'GGML_CUDA_NO_PINNED_WEIGHTS=1 is mandatory on this host' "$SERVE"
}
@test "frank-large serves the ik runtime from the unified-memory hybrid layout" {
grep -q 'ik_llama.cpp/build/bin/llama-server' "$ENV_FILE"
grep -q 'mradermacher-Qwen3.8-Flash-Next-Uncensored-i1-Q4_K_M' "$ENV_FILE"
grep -q -- '--gpu-layers "$NGL"' "$SERVE"
grep -q -- '--flash-attn "$FLASH_ATTN"' "$SERVE"
}
@test "frank-large keeps the fleet identity and the client port" {
grep -q '^LISTEN_PORT=7770$' "$ENV_FILE"
grep -q '^ALIAS=frank-large$' "$ENV_FILE"
grep -q -- '--port "$LISTEN_PORT"' "$SERVE"
grep -q -- '--host "$BIND_ADDR"' "$SERVE"
}
@test "frank-large decodes greedy by default (halogen client contract)" {
grep -q '^TEMPERATURE=0.0$' "$ENV_FILE"
grep -q -- '--temp "$TEMPERATURE"' "$SERVE"
}
@test "frank-large keeps image input via the mtmd mmproj" {
grep -q '^MMPROJ_PATH=.*mmproj-f16.gguf$' "$ENV_FILE"
grep -q -- '--mmproj "$MMPROJ_PATH"' "$SERVE"
}
@test "the deploy handler retires the halogen quadlet without deleting it" {
grep -q 'retire_quadlet_llm_large' "$REMOTE_DEPLOY"
grep -q 'systemctl --user stop frank-large.service' "$REMOTE_DEPLOY"
grep -q 'frank-large.container' "$REMOTE_DEPLOY"
grep -q 'HOME/.AGENTTRASH' "$REMOTE_DEPLOY"
! grep -qE '(^|[^[:alnum:]_])rm (-[a-zA-Z]+ )?.*frank-large' "$REMOTE_DEPLOY"
}
@test "the deploy handler installs the root unit and refuses a missing checkpoint" {
grep -q 'relink_unit frank-large' "$REMOTE_DEPLOY"
grep -q 'systemctl enable frank-large.service' "$REMOTE_DEPLOY"
grep -q 'checkpoint absent' "$REMOTE_DEPLOY"
! grep -q 'install_quadlet frank-large' "$REMOTE_DEPLOY"
}