#!/usr/bin/env bats # Seam: the frank-small llama.cpp root unit on dankclaw. # frank-small is the RTX 3090 endpoint; since 2026-10-01 night it serves # bartowski/MiMo-V2.6-Distill-Qwen-9B-GGUF:Q6_K via a CUDA (sm_86) build of # llama.cpp master, chosen for the ASYMMETRIC KV Frank asked for: K f16 # (unquantized) + V q8_0, which only llama.cpp exposes per-tensor. This # seam runs the serve script against a stub engine and asserts on the argv # it actually execs, so what is pinned is the command the operator gets. load helpers UNIT="$REPO_ROOT/scripts/frank-small.service" SERVE="$REPO_ROOT/scripts/serve-frank-small.sh" ENV_FILE="$REPO_ROOT/scripts/frank-small.env" REMOTE_DEPLOY="$REPO_ROOT/scripts/deploy-remote.sh" ENV_LARGE="$REPO_ROOT/scripts/frank-large.env" TARGET_STUB="MiMo-V2.6-Distill-Qwen-9B-Q6_K.gguf" setup() { STAGE="$(mktemp -d)" RUNTIME_DIR="$STAGE/llama" MODEL_DIR="$STAGE/models" mkdir -p "$RUNTIME_DIR/bin" "$MODEL_DIR" cat > "$RUNTIME_DIR/bin/llama-server" <<'STUB' #!/usr/bin/env bash printf '%s\n' "$@" STUB chmod +x "$RUNTIME_DIR/bin/llama-server" "$RUNTIME_DIR/bin" 2>/dev/null || chmod +x "$RUNTIME_DIR/bin/llama-server" touch "$MODEL_DIR/$TARGET_STUB" } teardown() { rm -rf "$STAGE" } # serve_argv [env-file] — run the serve script and capture the engine's # argv, one token per line, in $output. serve_argv() { local envf="${1:-$STAGE/test.env}" cat > "$envf" </dev/null grep -qxF -- '--jinja' <<<"$output" } @test "the serve script refuses a missing runtime or payload" { rm -f "$RUNTIME_DIR/bin/llama-server" serve_argv [ "$status" -ne 0 ] [[ "$output" == *"frank-small: missing"* ]] } @test "the deploy handler gates on the binary and the GGUF, then MainPID-hardens health" { grep -q 'deploy_llm_small' "$REMOTE_DEPLOY" grep -q 'LLM_SMALL_RUNTIME' "$REMOTE_DEPLOY" grep -q 'LLM_SMALL_MODEL_FILE' "$REMOTE_DEPLOY" grep -q 'relink_unit frank-small' "$REMOTE_DEPLOY" grep -q 'systemctl enable frank-small.service' "$REMOTE_DEPLOY" grep -q '127.0.0.1:7771/health' "$REMOTE_DEPLOY" grep -q 'frank-small.service has no MainPID' "$REMOTE_DEPLOY" } @test "the two endpoints keep separate ports and the large handler never pkills llama-server" { # frank-large's gufo sweep must not take down frank-small, whose # process is llama-server on the SAME host since this swap. grep -q '^LISTEN_PORT=7771$' "$ENV_FILE" local large large="$(sed -n '/^deploy_llm_large() {/,/^}/p' "$REMOTE_DEPLOY")" ! grep -q 'pkill -x llama-server' <<<"$large" }