panic at vk server topology, add vk to e2e
This commit is contained in:
1 parent
0cb812677a
commit
1cf840756a
11 files changed
+168
-51
No files matched your search
@@ -8,6 +8,7 @@ CTX="$DIR/.context"
|
||||
IMAGE=wlb-e2e-stand
|
||||
|
||||
COMPONENTS="\
|
||||
vk/headless-vk-creator \
|
||||
telemost/headless-telemost-creator \
|
||||
wbstream/headless-wbstream-creator \
|
||||
dion/headless-dion-creator \
|
||||
@@ -21,23 +22,11 @@ usage() {
|
||||
cat >&2 <<EOF
|
||||
Usage: stand.sh build | run [platform...] [scenario...] | sh
|
||||
|
||||
Dockerized live e2e: each of creator and joiner runs in its own network
|
||||
namespace (distinct IP), so same-host WebRTC ICE does not collide. Traffic is
|
||||
proved by echoing a nonce through the joiner's SOCKS5 to a sink on the creator's
|
||||
loopback - no external network, no rate limits.
|
||||
|
||||
build cross-build linux binaries, stage cookies, docker build
|
||||
build cross-build linux binaries, docker build
|
||||
run run the netns harness in a privileged container
|
||||
sh drop into a shell in the container for debugging
|
||||
|
||||
Platforms: telemost wbstream dion bitrix (VK has no headless SOCKS joiner)
|
||||
Scenarios: connect dc kcp dual kick
|
||||
|
||||
Cookies are mounted from cookies-<platform>.json at the repo root on run.
|
||||
Examples:
|
||||
stand.sh build
|
||||
stand.sh run
|
||||
stand.sh run bitrix dc kick
|
||||
See headless/tests/README.md.
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
@@ -55,12 +44,36 @@ build_context() {
|
||||
GOOS=linux GOARCH="$arch" CGO_ENABLED=0 \
|
||||
go -C "$REPO/headless/$d" build -trimpath -ldflags="-s -w" -o "$CTX/work/headless/$d/$b" .
|
||||
done
|
||||
mkdir -p "$CTX/work/relay"
|
||||
echo "building relay (linux/$arch)..."
|
||||
GOOS=linux GOARCH="$arch" CGO_ENABLED=0 \
|
||||
go -C "$REPO/relay" build -trimpath -ldflags="-s -w" -o "$CTX/work/relay/relay" .
|
||||
cp "$E2E/lib.sh" "$E2E/platforms.sh" "$E2E/scenarios.sh" "$CTX/work/headless/tests/"
|
||||
[ -f "$E2E/.env" ] && cp "$E2E/.env" "$CTX/work/headless/tests/"
|
||||
cp "$DIR/netns.sh" "$DIR/netns-run.sh" "$CTX/work/headless/tests/stand/"
|
||||
cp "$DIR/Dockerfile" "$CTX/Dockerfile"
|
||||
}
|
||||
|
||||
bridge_captcha() {
|
||||
_container="$1"
|
||||
_pidfile="$2"
|
||||
_seen=""
|
||||
while :; do
|
||||
sleep 2
|
||||
for _url in $(docker logs "$_container" 2>&1 | grep -o 'http://127\.0\.0\.1:[0-9][0-9]*/' | sort -u); do
|
||||
_port=$(echo "$_url" | sed 's|.*:\([0-9][0-9]*\)/|\1|')
|
||||
case " $_seen " in
|
||||
*" $_port "*) continue ;;
|
||||
esac
|
||||
_seen="$_seen $_port"
|
||||
echo "captcha at $_url, bridging into the joiner namespace"
|
||||
ncat -l 127.0.0.1 "$_port" --keep-open \
|
||||
--sh-exec "docker exec -i $_container ip netns exec joiner ncat 127.0.0.1 $_port" &
|
||||
echo $! >>"$_pidfile"
|
||||
open "$_url" 2>/dev/null || echo "open it yourself: $_url"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
build)
|
||||
build_context
|
||||
@@ -74,11 +87,27 @@ case "${1:-}" in
|
||||
f="$REPO/cookies-$c.json"
|
||||
[ -f "$f" ] && cookie_mounts="$cookie_mounts -v $f:/cookies/cookies-$c.json"
|
||||
done
|
||||
docker run --rm --cap-add=NET_ADMIN --cap-add=SYS_ADMIN \
|
||||
env_mount=""
|
||||
[ -f "$E2E/.env" ] && env_mount="-v $E2E/.env:/work/headless/tests/.env"
|
||||
container="$IMAGE-run"
|
||||
pidfile=$(mktemp -t wlb-captcha.XXXXXX)
|
||||
docker rm -f "$container" >/dev/null 2>&1 || true
|
||||
bridge_captcha "$container" "$pidfile" &
|
||||
watcher=$!
|
||||
status=0
|
||||
docker run --rm --name "$container" --cap-add=NET_ADMIN --cap-add=SYS_ADMIN \
|
||||
-e FAIL_FAST="${FAIL_FAST:-1}" \
|
||||
-e COOKIES_DIR=/cookies \
|
||||
$cookie_mounts \
|
||||
"$IMAGE" /work/headless/tests/stand/netns-run.sh "$@"
|
||||
$cookie_mounts $env_mount \
|
||||
"$IMAGE" /work/headless/tests/stand/netns-run.sh "$@" || status=$?
|
||||
if kill "$watcher" 2>/dev/null; then
|
||||
wait "$watcher" 2>/dev/null || true
|
||||
fi
|
||||
if [ -s "$pidfile" ]; then
|
||||
kill $(cat "$pidfile") 2>/dev/null || true
|
||||
fi
|
||||
rm -f "$pidfile"
|
||||
exit "$status"
|
||||
;;
|
||||
sh)
|
||||
docker run --rm -it --cap-add=NET_ADMIN --cap-add=SYS_ADMIN \
|
||||
|
||||
Reference in new issue
Block a user