test-subscriptions.sh raw

   1  #!/bin/bash
   2  # Simple subscription stability test script
   3  
   4  set -e
   5  
   6  RELAY_URL="${RELAY_URL:-ws://localhost:3334}"
   7  DURATION="${DURATION:-60}"
   8  KIND="${KIND:-1}"
   9  
  10  echo "==================================="
  11  echo "Subscription Stability Test"
  12  echo "==================================="
  13  echo ""
  14  echo "This tool tests whether subscriptions remain stable over time."
  15  echo ""
  16  echo "Configuration:"
  17  echo "  Relay URL: $RELAY_URL"
  18  echo "  Duration: ${DURATION}s"
  19  echo "  Event kind: $KIND"
  20  echo ""
  21  echo "To test properly, you should:"
  22  echo "  1. Start this test"
  23  echo "  2. In another terminal, publish events to the relay"
  24  echo "  3. Verify events are received throughout the test duration"
  25  echo ""
  26  
  27  # Check if the test tool is built
  28  if [ ! -f "./subscription-test" ]; then
  29      echo "Building subscription-test tool..."
  30      go build -o subscription-test ./cmd/subscription-test
  31      echo "✓ Built"
  32      echo ""
  33  fi
  34  
  35  # Run the test
  36  echo "Starting test..."
  37  echo ""
  38  
  39  ./subscription-test -url "$RELAY_URL" -duration "$DURATION" -kind "$KIND" -v
  40  
  41  exit $?
  42