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