run-sprocket-test.sh raw

   1  #!/bin/bash
   2  
   3  # Sprocket Integration Test Runner
   4  # This script sets up and runs the sprocket integration test
   5  
   6  set -e
   7  
   8  echo "๐Ÿงช Running Sprocket Integration Test"
   9  echo "===================================="
  10  
  11  # Check if Python 3 is available
  12  if ! command -v python3 &> /dev/null; then
  13      echo "โŒ Python 3 is required but not installed"
  14      exit 1
  15  fi
  16  
  17  # Check if jq is available (for the bash sprocket script)
  18  if ! command -v jq &> /dev/null; then
  19      echo "โŒ jq is required but not installed"
  20      exit 1
  21  fi
  22  
  23  # Check if gorilla/websocket is available
  24  echo "๐Ÿ“ฆ Installing test dependencies..."
  25  go mod tidy
  26  go get github.com/gorilla/websocket
  27  
  28  # Create test configuration directory
  29  TEST_CONFIG_DIR="$HOME/.config/ORLY_TEST"
  30  mkdir -p "$TEST_CONFIG_DIR"
  31  
  32  # Copy the Python sprocket script to the test directory
  33  cp test-sprocket.py "$TEST_CONFIG_DIR/sprocket.py"
  34  
  35  # Create a simple bash wrapper for the Python script
  36  cat > "$TEST_CONFIG_DIR/sprocket.sh" << 'EOF'
  37  #!/bin/bash
  38  python3 "$(dirname "$0")/sprocket.py"
  39  EOF
  40  
  41  chmod +x "$TEST_CONFIG_DIR/sprocket.sh"
  42  
  43  echo "๐Ÿ”ง Test setup complete"
  44  echo "๐Ÿ“ Sprocket script location: $TEST_CONFIG_DIR/sprocket.sh"
  45  
  46  # Run the integration test
  47  echo "๐Ÿš€ Starting integration test..."
  48  go test -v -run TestSprocketIntegration ./test-sprocket-integration.go
  49  
  50  echo "โœ… Sprocket integration test completed successfully!"
  51