Wait for packager to start
Reviewed By: shergin Differential Revision: D5408443 fbshipit-source-id: 4a9b37822c1f5c0db3d8be71862d5049bca1ecdd
This commit is contained in:
parent
6dd9d16833
commit
c885357cc9
|
@ -31,6 +31,25 @@ function cleanup {
|
||||||
}
|
}
|
||||||
trap cleanup EXIT
|
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.
|
# If first argument is "test", actually start the packager and run tests.
|
||||||
# Otherwise, just build RNTester for tvOS and exit
|
# 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
|
# Start the WebSocket test server
|
||||||
open "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically"
|
open "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically"
|
||||||
|
|
||||||
|
waitForPackager
|
||||||
|
|
||||||
# Preload the RNTesterApp bundle for better performance in integration tests
|
# 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
|
curl 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true' -o temp.bundle
|
||||||
rm temp.bundle
|
rm temp.bundle
|
||||||
curl 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true&minify=false' -o temp.bundle
|
curl 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true&minify=false' -o temp.bundle
|
||||||
|
|
Loading…
Reference in New Issue