interplane-forge
INTERPLANE Forge
Brought by drakestapleton
interplane-forge / server / tests / trial-real.sh
| 1 | #!/usr/bin/env bash |
| 2 | # server/tests/trial-real.sh: the counts and the JSON form on REAL data, before a deploy. |
| 3 | # bash server/tests/trial-real.sh (spark; FORGED_CPUS default 12-14; FORGE_TEST_PORT default 18487) |
| 4 | # Builds this tree with only the port and the data dir moved (a temp dir holding a copy of |
| 5 | # ~/forge-data/logs/forged.log), so it reads the real front-door nginx logs, the real routing table |
| 6 | # (rad) and getent, read-only, and writes its journal into the temp dir. Then: infra/smoke.sh local |
| 7 | # against it under both bases, the repo-home time of the first read (whole logs) and of the next |
| 8 | # read, and the forge/repo/1 counts of every public repo. Never touches 18480 or ~/forge-data. |
| 9 | set -euo pipefail |
| 10 | cd "$(dirname "$0")/../.." |
| 11 | CORES=${FORGED_CPUS:-12-14} |
| 12 | PORT=${FORGE_TEST_PORT:-18487} |
| 13 | OMC=$HOME/work/flux/omega-mv/seed/out/omc |
| 14 | T=$(mktemp -d) |
| 15 | pid= |
| 16 | trap '[ -n "$pid" ] && kill "$pid" 2>/dev/null; wait 2>/dev/null; [ -n "${KEEP:-}" ] || rm -rf "$T"' EXIT |
| 17 | mkdir -p "$T/data/logs" |
| 18 | cp "$HOME/forge-data/logs/forged.log" "$T/data/logs/forged.log" |
| 19 | { printf 'om2\n'; cat $(./run.sh units); } | sed -e "s|^text tfdata \".*\"|text tfdata \"$T/data/\"|" -e "s/18480/$PORT/g" > "$T/all.om" |
| 20 | taskset -c "$CORES" nice -n 10 "$OMC" < "$T/all.om" > "$T/forged" || { echo "BUILD FAILED"; exit 1; } |
| 21 | chmod 755 "$T/forged" |
| 22 | echo "trial build $(sha256sum < "$T/forged" | cut -d' ' -f1)" |
| 23 | taskset -c "$CORES" nice -n 10 "$T/forged" 2> "$T/err" & pid=$! |
| 24 | for i in $(seq 100); do curl -s -o /dev/null "http://127.0.0.1:$PORT/explore" && break; sleep 0.1; done |
| 25 | t() { curl -s -o "$T/b" -w '%{time_total}' -H "X-Forge-Base: /" "http://127.0.0.1:$PORT/$1"; } |
| 26 | echo "repo home, first read of the logs: $(t drakestapleton/cuda-crack) s" |
| 27 | echo "repo home, next read: $(t drakestapleton/cuda-crack) s" |
| 28 | echo "repo home JSON: $(t drakestapleton/cuda-crack.json) s" |
| 29 | echo "explore JSON: $(t explore.json) s" |
| 30 | t drakestapleton/cuda-crack > /dev/null; grep '<p class="meta">\(Clones\|Downloads\|Seeding\)' "$T/b" | sed 's/<[^>]*>//g' |
| 31 | echo "journal: $(grep -c '^e ' "$T/data/counts.log" 2> /dev/null || echo 0) events, $(grep -c '^k ' "$T/data/counts.log" 2> /dev/null || echo 0) cursor lines" |
| 32 | for n in $(curl -s -H "X-Forge-Base: /" "http://127.0.0.1:$PORT/explore.json" | jq -r '.repos[].name'); do |
| 33 | curl -s -H "X-Forge-Base: /" "http://127.0.0.1:$PORT/drakestapleton/$n.json" | |
| 34 | jq -r --arg n "$n" '[$n, .counts.git_fetches.count, .counts.upload_pack_requests.count, .counts.downloads.count, .counts.seeds.count] | map(tostring) | join(" ")' |
| 35 | done | column -t | sed '1i name fetches upload_pack downloads seeds' |
| 36 | echo "since: $(curl -s -H "X-Forge-Base: /" "http://127.0.0.1:$PORT/drakestapleton/cuda-crack.json" | jq -c '[.counts.git_fetches.since, .counts.upload_pack_requests.since, .counts.downloads.since, .counts.seeds.as_of]')" |
| 37 | FORGE_SMOKE_PORT=$PORT bash infra/smoke.sh local | grep -E '^(FAIL|smoke:)' |
| 38 | if [ -n "${EXTRA:-}" ]; then # the slices' own HTTP gates against this trial (dl writes dl/evidence/http-*.txt) |
| 39 | bash dl/tests/http-check.sh "$PORT" 2>&1 | grep -E "^(FAIL|RESULT)" |
| 40 | bash collab/tests/check.sh "http://127.0.0.1:$PORT" 2>&1 | grep -E "^(FAIL|collab:)" |
| 41 | fi |