crates/storage-git-gix/parked-gix/.nornir/bench/affinity-setup.sh
#!/usr/bin/env bash
# Provision a gunnar server and seed it with a production-shaped corpus:
# 12 pushes -> 12 packs, no repack, no bitmap.
set -euo pipefail
B=${TP_BINARY:?set TP_BINARY to the gunnar under test}
ROOT=${TP_ROOT:-/home/rickard/scratch/gunnar-tp}
DATA=$ROOT/data
SRC=${TP_SRC:-/home/rickard/git/nornir}/.git
PORT=18899
rm -rf "$DATA" "$ROOT/seed" "$ROOT/token"
mkdir -p "$DATA"
ssh-keygen -q -t ed25519 -N '' -f "$ROOT/id_ed25519" <<<y >/dev/null 2>&1 || true
"$B" --data-root "$DATA" namespace create bench
"$B" --data-root "$DATA" principal add bencher
"$B" --data-root "$DATA" key add bencher "@$ROOT/id_ed25519.pub"
"$B" --data-root "$DATA" repo create bench/conc --hash sha1
"$B" --data-root "$DATA" grant bencher write --repo bench/conc
"$B" --data-root "$DATA" token add bencher | grep -o 'gunnar_pat_[A-Za-z0-9_.-]*' > "$ROOT/token"
test -s "$ROOT/token" || { echo "FATAL: no token minted" >&2; exit 1; }
echo "token: $(cut -c1-20 "$ROOT/token")..."