Skip to content

Commit 4bcce29

Browse files
crawsiblejtarchie
authored andcommitted
give helpful message on unsupported stacks [#96590146]
Signed-off-by: JT Archie <[email protected]>
1 parent e01ae5d commit 4bcce29

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

bin/compile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ nginx_version="1.7.10"
1414

1515
compile_buildpack_dir=$(cd $(dirname $0); cd ..; pwd)
1616
compile_buildpack_bin=$compile_buildpack_dir/bin
17+
$compile_buildpack_dir/compile-extensions/bin/check_stack_support
1718

1819
# Load some convenience functions like status(), echo(), and indent()
1920
source $compile_buildpack_dir/bin/common.sh

cf_spec/unit/compile_spec.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
require 'spec_helper'
2+
3+
describe 'When running ./bin/compile' do
4+
context 'and on an unsupported stack' do
5+
before(:all) do
6+
@output = `env CF_STACK='unsupported' ./bin/compile #{Dir.mktmpdir} #{Dir.mktmpdir} 2>&1`
7+
end
8+
9+
it 'displays a helpful error message' do
10+
expect(@output).to include('not supported by this buildpack')
11+
end
12+
13+
it 'exits with our error code' do
14+
expect($?.exitstatus).to eq 44
15+
end
16+
end
17+
18+
context 'and on a supported stack' do
19+
before(:all) do
20+
@output = `env CF_STACK='cflinuxfs2' ./bin/compile #{Dir.mktmpdir} #{Dir.mktmpdir} 2>&1`
21+
end
22+
23+
it 'displays a helpful error message' do
24+
expect(@output).to_not include('not supported by this buildpack')
25+
end
26+
27+
it 'does not exit with our error code' do
28+
expect($?.exitstatus).to_not eq 44
29+
end
30+
end
31+
end
32+

compile-extensions

0 commit comments

Comments
 (0)