#!/usr/bin/env bash # logwisp chain test: edge-tcp and edge-http feed a relay that runs one # pipeline per transport, without fan-in (chain-aggregate-test.sh fans in). # Requires: bash 5+, coreutils (timeout), curl. Linux dev host only. set -u . "$(dirname -- "${BASH_SOURCE[0]}")/lib.sh" RUN=$E2E_DIR/run PORT_TCP_CHAIN=15801 PORT_HTTP_CHAIN=15802 PORT_TCP_SINK=15803 PORT_HTTP_SINK=15804 PORTS="$PORT_TCP_CHAIN $PORT_HTTP_CHAIN $PORT_TCP_SINK $PORT_HTTP_SINK" e2e_init "$@" section "Setup" need curl ports_free $PORTS mkdir -p "$CONF" "$LOG" edge_conf() { # name sink_type port [sink options] cat >"$CONF/$1.toml" <"$CONF/relay.toml" < nc 127.0.0.1 $PORT_TCP_SINK > curl -N http://127.0.0.1:$PORT_HTTP_SINK/stream > curl http://127.0.0.1:$PORT_HTTP_SINK/status Logs: $(short "$LOG")/ EOF manual_hold section "Checks" info "settling 3 s (connect, first http_chain flush)" sleep 3 # 1. TCP chain: edge-tcp -> relay -> tcp sink tcp_out="$(tcp_read "$PORT_TCP_SINK" 4)" n=$(grep -c 'edge-tcp/' <<<"$tcp_out") check "tcp path: entries on :$PORT_TCP_SINK with node=edge-tcp ($n lines)" $((n >= 1)) # 2. HTTP chain: edge-http -> relay -> SSE sink sse_out="$(curl -sN --noproxy '*' --max-time 4 "http://127.0.0.1:$PORT_HTTP_SINK/stream" || true)" n=$(grep -c '^data:.*edge-http/' <<<"$sse_out") check "http path: SSE events on :$PORT_HTTP_SINK with node=edge-http ($n events)" $((n >= 1)) # 3. HTTP sink status endpoint status="$(curl -s --noproxy '*' --max-time 3 "http://127.0.0.1:$PORT_HTTP_SINK/status" || true)" proc=$(grep -o '"total_processed"[ :] *[0-9]*' <<<"$status" | grep -o '[0-9]*' || echo 0) check "status endpoint: total_processed=$proc > 0" $((proc > 0)) summary