2026-10-01 13:19:16 +02:00
|
|
|
#!/usr/bin/env bash
|
2026-10-03 11:42:03 +02:00
|
|
|
# Drives PrivaPub and each peer (started by run.sh) through each other's federation, as their users would, then checks
|
|
|
|
|
# that PrivaPub's statistics saw it all without naming anyone.
|
2026-10-05 05:32:01 +02:00
|
|
|
# usage: tools/pasture/interop.sh [peer...] peers: gts (default), mastodon, misskey, sharkey, akkoma, lemmy,
|
|
|
|
|
# peertube, crawler
|
2026-10-01 13:19:16 +02:00
|
|
|
set -uo pipefail
|
2026-10-03 11:42:03 +02:00
|
|
|
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
|
. "$here/lib/interop.sh"
|
2026-10-05 05:32:01 +02:00
|
|
|
peers=("${@:-gts}")
|
|
|
|
|
# a run replaces what the peers it runs said last time, and keeps what the others said
|
|
|
|
|
if [ -s "$INTEROP_JSONL" ]; then
|
|
|
|
|
python3 - "$INTEROP_JSONL" "${peers[@]}" <<'PY'
|
|
|
|
|
import json, sys
|
|
|
|
|
path, peers = sys.argv[1], set(sys.argv[2:])
|
|
|
|
|
kept = [line for line in open(path) if line.strip() and json.loads(line).get("peer") not in peers]
|
|
|
|
|
open(path, "w").writelines(kept)
|
|
|
|
|
PY
|
|
|
|
|
fi
|
2026-10-01 13:19:16 +02:00
|
|
|
|
2026-10-05 05:32:01 +02:00
|
|
|
for peer in "${peers[@]}"; do
|
2026-10-03 11:42:03 +02:00
|
|
|
[ -f "$here/scenarios/$peer.sh" ] || { echo "no scenario for $peer" >&2; exit 2; }
|
2026-10-05 00:32:54 +02:00
|
|
|
INTEROP_PEER=$peer
|
2026-10-03 11:42:03 +02:00
|
|
|
. "$here/scenarios/$peer.sh"
|
|
|
|
|
done
|
2026-10-01 13:19:16 +02:00
|
|
|
|
2026-10-03 11:42:03 +02:00
|
|
|
echo; echo "$pass passed, $fail failed, $expected expected failures"
|
2026-10-01 13:19:16 +02:00
|
|
|
[ "$fail" = 0 ]
|