Commit 7f2947e3 authored by Hunter Loftis's avatar Hunter Loftis

retry all failed curls; update tests

parent 80213033
...@@ -13,12 +13,12 @@ install_nodejs() { ...@@ -13,12 +13,12 @@ install_nodejs() {
if needs_resolution "$version"; then if needs_resolution "$version"; then
echo "Resolving node version ${version:-(latest stable)} via semver.io..." echo "Resolving node version ${version:-(latest stable)} via semver.io..."
local version=$(curl --silent --get --data-urlencode "range=${version}" https://semver.herokuapp.com/node/resolve) local version=$(curl --silent --get --retry 5 --retry-max-time 15 --data-urlencode "range=${version}" https://semver.herokuapp.com/node/resolve)
fi fi
echo "Downloading and installing node $version..." echo "Downloading and installing node $version..."
local download_url="http://s3pository.heroku.com/node/v$version/node-v$version-$os-$cpu.tar.gz" local download_url="http://s3pository.heroku.com/node/v$version/node-v$version-$os-$cpu.tar.gz"
curl "$download_url" --silent --fail -o /tmp/node.tar.gz || (echo "Unable to download node $version; does it exist?" && false) curl "$download_url" --silent --fail --retry 5 --retry-max-time 15 -o /tmp/node.tar.gz || (echo "Unable to download node $version; does it exist?" && false)
tar xzf /tmp/node.tar.gz -C /tmp tar xzf /tmp/node.tar.gz -C /tmp
mv /tmp/node-v$version-$os-$cpu/* $dir mv /tmp/node-v$version-$os-$cpu/* $dir
chmod +x $dir/bin/* chmod +x $dir/bin/*
...@@ -30,12 +30,12 @@ install_iojs() { ...@@ -30,12 +30,12 @@ install_iojs() {
if needs_resolution "$version"; then if needs_resolution "$version"; then
echo "Resolving iojs version ${version:-(latest stable)} via semver.io..." echo "Resolving iojs version ${version:-(latest stable)} via semver.io..."
version=$(curl --silent --get --data-urlencode "range=${version}" https://semver.herokuapp.com/iojs/resolve) version=$(curl --silent --get --retry 5 --retry-max-time 15 --data-urlencode "range=${version}" https://semver.herokuapp.com/iojs/resolve)
fi fi
echo "Downloading and installing iojs $version..." echo "Downloading and installing iojs $version..."
local download_url="https://iojs.org/dist/v$version/iojs-v$version-$os-$cpu.tar.gz" local download_url="https://iojs.org/dist/v$version/iojs-v$version-$os-$cpu.tar.gz"
curl "$download_url" --silent --fail -o /tmp/node.tar.gz || (echo "Unable to download iojs $version; does it exist?" && false) curl "$download_url" --silent --fail --retry 5 --retry-max-time 15 -o /tmp/node.tar.gz || (echo "Unable to download iojs $version; does it exist?" && false)
tar xzf /tmp/node.tar.gz -C /tmp tar xzf /tmp/node.tar.gz -C /tmp
mv /tmp/iojs-v$version-$os-$cpu/* $dir mv /tmp/iojs-v$version-$os-$cpu/* $dir
chmod +x $dir/bin/* chmod +x $dir/bin/*
......
...@@ -63,7 +63,7 @@ warn_missing_package_json() { ...@@ -63,7 +63,7 @@ warn_missing_package_json() {
warn_old_npm() { warn_old_npm() {
local npm_version="$(npm --version)" local npm_version="$(npm --version)"
if [ "${npm_version:0:1}" -lt "2" ]; then if [ "${npm_version:0:1}" -lt "2" ]; then
local latest_npm="$(curl --silent --get https://semver.herokuapp.com/npm/stable)" local latest_npm="$(curl --silent --get --retry 5 --retry-max-time 15 https://semver.herokuapp.com/npm/stable)"
warning "This version of npm ($npm_version) has several known issues - consider upgrading to the latest release ($latest_npm)" "https://devcenter.heroku.com/articles/nodejs-support#specifying-an-npm-version" warning "This version of npm ($npm_version) has several known issues - consider upgrading to the latest release ($latest_npm)" "https://devcenter.heroku.com/articles/nodejs-support#specifying-an-npm-version"
fi fi
} }
......
...@@ -196,7 +196,7 @@ testNoVersion() { ...@@ -196,7 +196,7 @@ testNoVersion() {
compile "no-version" compile "no-version"
assertCaptured "engines.node (package.json): unspecified" assertCaptured "engines.node (package.json): unspecified"
assertCaptured "Resolving node version (latest stable) via semver.io" assertCaptured "Resolving node version (latest stable) via semver.io"
assertCaptured "Downloading and installing node 4." assertCaptured "Downloading and installing node 5."
assertCapturedSuccess assertCapturedSuccess
} }
...@@ -300,7 +300,7 @@ testDangerousRangeStar() { ...@@ -300,7 +300,7 @@ testDangerousRangeStar() {
compile "dangerous-range-star" compile "dangerous-range-star"
assertCaptured "Dangerous semver range" assertCaptured "Dangerous semver range"
assertCaptured "Resolving node version * via semver.io" assertCaptured "Resolving node version * via semver.io"
assertCaptured "Downloading and installing node 4." assertCaptured "Downloading and installing node 5."
assertCapturedError assertCapturedError
} }
...@@ -308,14 +308,14 @@ testDangerousRangeGreaterThan() { ...@@ -308,14 +308,14 @@ testDangerousRangeGreaterThan() {
compile "dangerous-range-greater-than" compile "dangerous-range-greater-than"
assertCaptured "Dangerous semver range" assertCaptured "Dangerous semver range"
assertCaptured "Resolving node version >0.4 via semver.io" assertCaptured "Resolving node version >0.4 via semver.io"
assertCaptured "Downloading and installing node 4." assertCaptured "Downloading and installing node 5."
assertCapturedError assertCapturedError
} }
testRangeWithSpace() { testRangeWithSpace() {
compile "range-with-space" compile "range-with-space"
assertCaptured "Resolving node version >= 0.8.x via semver.io" assertCaptured "Resolving node version >= 0.8.x via semver.io"
assertCaptured "Downloading and installing node 4." assertCaptured "Downloading and installing node 5."
assertCapturedSuccess assertCapturedSuccess
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment