Skip to content

Commit

Permalink
Merge pull request #251 from heroku/fix-invalid-bin-gzip
Browse files Browse the repository at this point in the history
test and implementation to detect un-downloadable binaries
  • Loading branch information
hunterloftis committed Jul 22, 2015
2 parents bc0bcf7 + aa8f09e commit aeac9d6
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Upcoming

- Fix runtime signature cache invalidation
- Provide error messaging for un-downloadable binaries

## v77

Expand Down
6 changes: 4 additions & 2 deletions lib/binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ install_nodejs() {

echo "Downloading and installing node $version..."
local download_url="http://s3pository.heroku.com/node/v$version/node-v$version-$os-$cpu.tar.gz"
curl "$download_url" -s -o - | tar xzf - -C /tmp
curl "$download_url" --silent --fail -o /tmp/node.tar.gz || (echo "Unable to download node $version; does it exist?" && false)
tar xzf /tmp/node.tar.gz -C /tmp
mv /tmp/node-v$version-$os-$cpu/* $dir
chmod +x $dir/bin/*
}
Expand All @@ -34,7 +35,8 @@ install_iojs() {

echo "Downloading and installing iojs $version..."
local download_url="https://iojs.org/dist/v$version/iojs-v$version-$os-$cpu.tar.gz"
curl $download_url -s -o - | tar xzf - -C /tmp
curl "$download_url" --silent --fail -o /tmp/node.tar.gz || (echo "Unable to download iojs $version; does it exist?" && false)
tar xzf /tmp/node.tar.gz -C /tmp
mv /tmp/iojs-v$version-$os-$cpu/* $dir
chmod +x $dir/bin/*
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"type" : "git",
"url" : "https://github.com/example/example.git"
},
"dependencies": {
},
"engines": {
"node": ">2.0"
"iojs": "2.0.99"
}
}
1 change: 1 addition & 0 deletions test/fixtures/invalid-node/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A fake README, to keep npm from polluting stderr.
14 changes: 14 additions & 0 deletions test/fixtures/invalid-node/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "node-buildpack-test-app",
"version": "0.0.1",
"description": "node buildpack integration test app",
"repository" : {
"type" : "git",
"url" : "https://github.com/example/example.git"
},
"dependencies": {
},
"engines": {
"node": "0.11.33"
}
}
14 changes: 14 additions & 0 deletions test/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#!/usr/bin/env bash
# See README.md for info on running these tests.

testInvalidNode() {
compile "invalid-node"
assertCaptured "Downloading and installing node 0.11.33"
assertCaptured "Unable to download node 0.11.33"
assertCapturedError
}

testInvalidIo() {
compile "invalid-io"
assertCaptured "Downloading and installing iojs 2.0.99"
assertCaptured "Unable to download iojs 2.0.99"
assertCapturedError
}

testBuildWithCache() {
cache=$(mktmpdir)

Expand Down

0 comments on commit aeac9d6

Please sign in to comment.