interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / server / tests / trial-real.sh

41 lines · 3212 bytes Raw Blame History
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.
9set -euo pipefail
10cd "$(dirname "$0")/../.."
11CORES=${FORGED_CPUS:-12-14}
12PORT=${FORGE_TEST_PORT:-18487}
13OMC=$HOME/work/flux/omega-mv/seed/out/omc
14T=$(mktemp -d)
15pid=
16trap '[ -n "$pid" ] && kill "$pid" 2>/dev/null; wait 2>/dev/null; [ -n "${KEEP:-}" ] || rm -rf "$T"' EXIT
17mkdir -p "$T/data/logs"
18cp "$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"
20taskset -c "$CORES" nice -n 10 "$OMC" < "$T/all.om" > "$T/forged" || { echo "BUILD FAILED"; exit 1; }
21chmod 755 "$T/forged"
22echo "trial build $(sha256sum < "$T/forged" | cut -d' ' -f1)"
23taskset -c "$CORES" nice -n 10 "$T/forged" 2> "$T/err" & pid=$!
24for i in $(seq 100); do curl -s -o /dev/null "http://127.0.0.1:$PORT/explore" && break; sleep 0.1; done
25t() { curl -s -o "$T/b" -w '%{time_total}' -H "X-Forge-Base: /" "http://127.0.0.1:$PORT/$1"; }
26echo "repo home, first read of the logs: $(t drakestapleton/cuda-crack) s"
27echo "repo home, next read: $(t drakestapleton/cuda-crack) s"
28echo "repo home JSON: $(t drakestapleton/cuda-crack.json) s"
29echo "explore JSON: $(t explore.json) s"
30t drakestapleton/cuda-crack > /dev/null; grep '<p class="meta">\(Clones\|Downloads\|Seeding\)' "$T/b" | sed 's/<[^>]*>//g'
31echo "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"
32for 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(" ")'
35done | column -t | sed '1i name fetches upload_pack downloads seeds'
36echo "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]')"
37FORGE_SMOKE_PORT=$PORT bash infra/smoke.sh local | grep -E '^(FAIL|smoke:)'
38if [ -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:)"
41fi