Skip to content

chore(browserstack): properly teardown tunnel #1745

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

Merged
merged 2 commits into from
Nov 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/browserstack/start_tunnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ tunnel.start(function(error) {
});

if (READY_FILE) {
fs.writeFile(READY_FILE, '');
fs.writeFile(READY_FILE, process.pid);
}
}
});
Expand Down
16 changes: 14 additions & 2 deletions scripts/browserstack/teardown_tunnel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,17 @@ set -e -o pipefail


echo "Shutting down Browserstack tunnel"
echo "TODO: implement me"
exit 1

PID=$(cat $BROWSER_PROVIDER_READY_FILE);

# Resolving the PID from the readyfile.
kill $PID


while [[ -n `ps -ef | grep $PID | grep -v "grep"` ]]; do
printf "."
sleep .5
done
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth capping how long we wait here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it just helps ensuring that the Browserstack tunnel is properly turned off.

Normally the while does not run once, because the process terminated synchronously before, but in some situations it might take longer (crashes etc.) and this might help us as well.

Also added because the Saucelabs teardown script had the same.


echo ""
echo "Browserstack tunnel has been shut down"
2 changes: 1 addition & 1 deletion scripts/ci/sources/tunnel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ teardown_tunnel() {
./scripts/sauce/sauce_connect_teardown.sh
;;
browserstack*)
# ./scripts/browserstack/teardown_tunnel.sh
./scripts/browserstack/teardown_tunnel.sh
;;
*)
;;
Expand Down