-
Notifications
You must be signed in to change notification settings - Fork 6.8k
chore: remove inactive browserstack wrapper package #1991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
6b5662b
168afd6
a64876e
e5ece42
eb232ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,71 @@ | ||
export BROWSER_STACK_ACCESS_KEY=`echo $BROWSER_STACK_ACCESS_KEY | rev` | ||
#!/bin/bash | ||
|
||
node ./scripts/browserstack/start_tunnel.js & | ||
set -e -o pipefail | ||
|
||
# Workaround for Travis CI cookbook https://github.com/travis-ci/travis-ci/issues/4862, | ||
# where $PATH will be extended with relative paths to the NPM binaries. | ||
PATH=`echo $PATH | sed -e 's/:\.\/node_modules\/\.bin//'` | ||
|
||
TUNNEL_FILE="BrowserStackLocal-linux-x64.zip" | ||
TUNNEL_URL="https://www.browserstack.com/browserstack-local/$TUNNEL_FILE" | ||
TUNNEL_DIR="/tmp/browserstack-tunnel" | ||
TUNNEL_LOG="$LOGS_DIR/browserstack-tunnel.log" | ||
|
||
BROWSER_STACK_ACCESS_KEY=`echo $BROWSER_STACK_ACCESS_KEY | rev` | ||
|
||
# Cleanup and create the folder structure for the tunnel connector. | ||
rm -rf $TUNNEL_DIR $BROWSER_PROVIDER_READY_FILE | ||
mkdir -p $TUNNEL_DIR | ||
touch $TUNNEL_LOG | ||
|
||
cd $TUNNEL_DIR | ||
|
||
# Download the browserstack local binaries. | ||
curl $TUNNEL_URL -o $TUNNEL_FILE 2> /dev/null 1> /dev/null | ||
|
||
# Extract the browserstack local binaries from the tarball. | ||
mkdir -p browserstack-tunnel | ||
unzip -q $TUNNEL_FILE -d browserstack-tunnel | ||
|
||
# Cleanup the download directory. | ||
rm $TUNNEL_FILE | ||
|
||
ARGS="" | ||
|
||
# Set tunnel-id only on Travis, to make local testing easier. | ||
if [ ! -z "$TRAVIS_JOB_NUMBER" ]; then | ||
ARGS="$ARGS --local-identifier $TRAVIS_JOB_NUMBER" | ||
fi | ||
|
||
echo "Starting Browserstack Local in the background, logging into:" | ||
echo " $TUNNEL_LOG" | ||
echo " ---" | ||
echo " $ARGS" | ||
|
||
# Extension to the BrowserStackLocal binaries, because those can't create a readyfile. | ||
function create_ready_file { | ||
|
||
# To be able to exit the tail properly we need to have a sub shell spawned, which is | ||
# used to track the state of tail. | ||
{ sleep 120; touch $BROWSER_PROVIDER_ERROR_FILE; } & | ||
|
||
TIMER_PID=$! | ||
|
||
# Disown the background process, because we don't want to show any messages when killing | ||
# the timer. | ||
disown | ||
|
||
# When the tail recognizes the `Ctrl-C` log message the BrowserStack Tunnel is up. | ||
{ | ||
tail -n0 -f $TUNNEL_LOG --pid $TIMER_PID | { sed '/Ctrl/q' && kill -9 $TIMER_PID; }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it takes more than 2 minutes the The way to do that would be (my BASH is rusty) to, instead of just (sleep 120; echo ERROR TIMEOUT > $BROWSER_STACK_ERROR_FILE) & then on the wait tunnel script, if ERROR_FILE exists just exit with a special code that fails the test. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The tail should only run 2 minutes at maximum. If the specific string was found then the Did you mean something else? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, if the tail runs for longer than 2 minutes because the connection to the tunnel takes longer. The timer will terminate but the process will succeed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. Yeah I like that idea with the |
||
} &> /dev/null | ||
|
||
echo "BrowserStack Tunnel ready" | ||
|
||
touch $BROWSER_PROVIDER_READY_FILE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not 100% convinced yet that this is right; what if you run these scripts locally on your computer? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can see what you mean, but I think you won't be able to fix this for saucelabs, because the integrated There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay that's fair. |
||
} | ||
|
||
browserstack-tunnel/BrowserStackLocal -k $BROWSER_STACK_ACCESS_KEY $ARGS &>> $TUNNEL_LOG & | ||
|
||
# Wait for the tunnel to be ready and create the readyfile with the Browserstack PID | ||
create_ready_file & |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#!/bin/bash | ||
|
||
TUNNEL_LOG="$LOGS_DIR/browserstack-tunnel.log" | ||
|
||
# Wait for Connect to be ready before exiting | ||
# Time out if we wait for more than 2 minutes, so the process won't run forever. | ||
|
@@ -12,6 +13,11 @@ while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do | |
echo | ||
echo "Timed out after 2 minutes waiting for tunnel ready file" | ||
exit 5 | ||
elif [ -f $BROWSER_PROVIDER_ERROR_FILE ]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a race condition here, since READY_FILE will still be created when ERROR_FILE exists. Moving this |
||
echo | ||
echo "An error occurred while starting the tunnel. See error:" | ||
cat $TUNNEL_LOG | ||
exit 5 | ||
fi | ||
|
||
printf "." | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to disown here, since you're
&> /dev/null
below. Right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
&> /dev/null
won't have an effect on that, because when using thekill
command the process always prints a message that thechild-process
terminated.