Permalink
Browse files

Wait for packager to start

Reviewed By: shergin

Differential Revision: D5408443

fbshipit-source-id: 4a9b37822c1f5c0db3d8be71862d5049bca1ecdd
  • Loading branch information...
TheSavior authored and facebook-github-bot committed Jul 13, 2017
1 parent 6dd9d16 commit c885357cc97ad047bac25efac8bbf9989bac7b4d
Showing with 21 additions and 1 deletion.
  1. +21 −1 scripts/objc-test.sh
View
@@ -31,6 +31,25 @@ function cleanup {
}
trap cleanup EXIT
# Wait for the package to start
function waitForPackager {
local -i max_attempts=60
local -i attempt_num=1
until $(curl -s http://localhost:8081/status | grep "packager-status:running" -q); do
if (( attempt_num == max_attempts )); then
echo "Packager did not respond in time. No more attempts left."
exit 1
else
(( attempt_num++ ))
echo "Packager did not respond. Retrying for attempt number $attempt_num..."
sleep 1
fi
done
echo "Packager is ready!"
}
# If first argument is "test", actually start the packager and run tests.
# Otherwise, just build RNTester for tvOS and exit
@@ -41,8 +60,9 @@ open "./scripts/launchPackager.command" || echo "Can't start packager automatica
# Start the WebSocket test server
open "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically"
waitForPackager
# Preload the RNTesterApp bundle for better performance in integration tests
sleep 20
curl 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true' -o temp.bundle
rm temp.bundle
curl 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true&minify=false' -o temp.bundle

0 comments on commit c885357

Please sign in to comment.