Skip to content

Commit aeac9d6

Browse files
committed
Merge pull request heroku#251 from heroku/fix-invalid-bin-gzip
test and implementation to detect un-downloadable binaries
2 parents bc0bcf7 + aa8f09e commit aeac9d6

File tree

7 files changed

+37
-3
lines changed

7 files changed

+37
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Upcoming
22

33
- Fix runtime signature cache invalidation
4+
- Provide error messaging for un-downloadable binaries
45

56
## v77
67

lib/binaries.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ install_nodejs() {
1818

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

3536
echo "Downloading and installing iojs $version..."
3637
local download_url="https://iojs.org/dist/v$version/iojs-v$version-$os-$cpu.tar.gz"
37-
curl $download_url -s -o - | tar xzf - -C /tmp
38+
curl "$download_url" --silent --fail -o /tmp/node.tar.gz || (echo "Unable to download iojs $version; does it exist?" && false)
39+
tar xzf /tmp/node.tar.gz -C /tmp
3840
mv /tmp/iojs-v$version-$os-$cpu/* $dir
3941
chmod +x $dir/bin/*
4042
}
File renamed without changes.

test/fixtures/invalid-node-version/package.json renamed to test/fixtures/invalid-io/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"type" : "git",
77
"url" : "http://github.com/example/example.git"
88
},
9+
"dependencies": {
10+
},
911
"engines": {
10-
"node": ">2.0"
12+
"iojs": "2.0.99"
1113
}
1214
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A fake README, to keep npm from polluting stderr.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "node-buildpack-test-app",
3+
"version": "0.0.1",
4+
"description": "node buildpack integration test app",
5+
"repository" : {
6+
"type" : "git",
7+
"url" : "http://github.com/example/example.git"
8+
},
9+
"dependencies": {
10+
},
11+
"engines": {
12+
"node": "0.11.33"
13+
}
14+
}

test/run

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
#!/usr/bin/env bash
22
# See README.md for info on running these tests.
33

4+
testInvalidNode() {
5+
compile "invalid-node"
6+
assertCaptured "Downloading and installing node 0.11.33"
7+
assertCaptured "Unable to download node 0.11.33"
8+
assertCapturedError
9+
}
10+
11+
testInvalidIo() {
12+
compile "invalid-io"
13+
assertCaptured "Downloading and installing iojs 2.0.99"
14+
assertCaptured "Unable to download iojs 2.0.99"
15+
assertCapturedError
16+
}
17+
418
testBuildWithCache() {
519
cache=$(mktmpdir)
620

0 commit comments

Comments
 (0)