Skip to content

Instantly share code, notes, and snippets.

@bobzoller
Forked from mhodgson/testingbot_tunnel_setup.sh
Last active April 2, 2021 20:10
Show Gist options
  • Save bobzoller/0f1bccd941db5328b00d to your computer and use it in GitHub Desktop.
Save bobzoller/0f1bccd941db5328b00d to your computer and use it in GitHub Desktop.
#!/bin/bash
# Setup and start TEstingBot for your TravisCI build
# This script requires your .travis.yml to include the following two private env variables:
# TESTINGBOT_KEY
# TESTINGBOT_SECRET
# Follow the steps at http://blog.testingbot.com/2012/12/31/travis-ci-selenium-testing-with-testingbot to set that up.
#
# Curl and run this script as part of your .travis.yml before_script section:
# before_script:
# - curl https://gist.githubusercontent.com/bobzoller/0f1bccd941db5328b00d/raw/testingbot_tunnel_setup.sh | bash
TUNNEL_JAR_URL="http://testingbot.com/downloads/testingbot-tunnel.zip"
TUNNEL_DIR="/tmp/testingbot-tunnel-$RANDOM"
TUNNEL_JAR_DOWNLOAD="testingbot-tunnel.zip"
READY_FILE="testingbot-ready-$RANDOM"
TUNNEL_LOG_FILE="testingbot-log-$RANDOM.log"
# Get Tunnel and start it
mkdir -p $TUNNEL_DIR
cd $TUNNEL_DIR
curl $TUNNEL_JAR_URL > $TUNNEL_JAR_DOWNLOAD
unzip -q $TUNNEL_JAR_DOWNLOAD
rm $TUNNEL_JAR_DOWNLOAD
cd testingbot-tunnel
java -jar testingbot-tunnel.jar $TESTINGBOT_KEY $TESTINGBOT_SECRET \
--readyfile $READY_FILE \
--squid \
--boost \
--logfile $TUNNEL_LOG_FILE &
# Wait for Connect to be ready before exiting
TIMEOUT=$((`date '+%s'` + 60))
while [ ! -f $READY_FILE ]; do
sleep 1
if [ `date '+%s'` -ge $TIMEOUT ]; then
echo "ERROR: Timeout waiting for Testingbot-Tunnel to start"
exit 1
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment