#!/bin/bash # # Run the full testsuite against an external (non-compose) Prosody deployment # in a single pytest invocation (unified summary). # # For per-file selective runs, use run-tests.sh instead. # # Tests that need compose-specific infrastructure (docker exec, MOCK_URL, # low smacks_hibernation_time) will skip automatically. # # Prerequisites: # 1. SSH tunnel to PostgreSQL: # ssh -p 60024 developer@148.251.101.234 -f -N -M -S /tmp/vncddb.sock -L 14322:127.0.0.1:5432 # 2. kubectl port-forward for telnet: # kubectl port-forward services/telnet 5582:5582 -n prosody # set -euo pipefail # --------------------------------------------------------------------------- # 0. Verify prerequisites: SSH tunnel (PG) and kubectl port-forward (telnet) # --------------------------------------------------------------------------- SSH_SOCK=/tmp/vncddb.sock PG_PORT=14322 TELNET_PORT=5582 check_pg_tunnel() { if ! ss -tlnp 2>/dev/null | grep -q ":${PG_PORT} "; then echo ">>> PostgreSQL tunnel not active — starting SSH tunnel" ssh -p 60024 developer@148.251.101.234 -f -N -M -S "$SSH_SOCK" \ -L ${PG_PORT}:127.0.0.1:5432 sleep 1 if ! ss -tlnp 2>/dev/null | grep -q ":${PG_PORT} "; then echo "ERROR: SSH tunnel to PostgreSQL failed to start" >&2 exit 1 fi fi echo ">>> PostgreSQL tunnel OK (port ${PG_PORT})" } check_telnet_pf() { if ! ss -tlnp 2>/dev/null | grep -q ":${TELNET_PORT} "; then echo ">>> Telnet port-forward not active — starting kubectl port-forward" kubectl port-forward services/telnet ${TELNET_PORT}:5582 -n prosody & KUBECTL_PF_PID=$! sleep 2 if ! ss -tlnp 2>/dev/null | grep -q ":${TELNET_PORT} "; then echo "ERROR: kubectl port-forward for telnet failed to start" >&2 exit 1 fi fi echo ">>> Telnet port-forward OK (port ${TELNET_PORT})" } check_pg_tunnel check_telnet_pf # --------------------------------------------------------------------------- # 1. Test env vars # --------------------------------------------------------------------------- export XMPP_HOST=xmpp.microlab.zimbra-vnc.de export XMPP_PORT=30522 export XMPP_JID=lisa.porter@microlab.zimbra-vnc.de export XMPP_PASSWORD=q3tx65test export XMPP_JID2=richard.watson@microlab.zimbra-vnc.de export XMPP_PASSWORD2=q3tx65test export XMPP_DOMAIN=microlab.zimbra-vnc.de export BOSH_URL=https://xmpp.microlab.zimbra-vnc.de/http-bind export WS_URL=wss://xmpp.microlab.zimbra-vnc.de/xmpp-websocket export REST_URL=https://xmpprest.microlab.zimbra-vnc.de/rest export MUC_DOMAIN=conference.microlab.zimbra-vnc.de export ADMIN_TELNET_HOST=127.0.0.1 export ADMIN_TELNET_PORT=5582 export REST_USER=vnctalk export REST_PASSWORD=ohtai2Eicai4aiting7bec2am6Aih export PG_HOST=localhost export PG_PORT=14322 export PG_DB=prosody export PG_USER=prosody export PG_PASSWORD=eS5Gi7ahzo3chaiXiel0ief # --------------------------------------------------------------------------- # 2. Run the testsuite # --------------------------------------------------------------------------- pytest tests/ -v -c tests/pytest.ini # --------------------------------------------------------------------------- # 3. Cleanup kubectl port-forward if we started it # --------------------------------------------------------------------------- if [[ -n "${KUBECTL_PF_PID:-}" ]]; then echo ">>> stopping kubectl port-forward (PID ${KUBECTL_PF_PID})" kill "$KUBECTL_PF_PID" 2>/dev/null || true fi