Skip to content

Commit e0daa2c

Browse files
committed
Non-zero exit on failure in compile
Previously, if a failure occurred in compile, the exit code was undefined. To meet the buildpack contract, a non-zero exit code is now returned in the case of a failure in the compile script. [#49421485]
1 parent 7ceefa0 commit e0daa2c

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

spec/bin/compile_spec.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Cloud Foundry Java Buildpack
2+
# Copyright (c) 2013 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
require 'spec_helper'
17+
require 'open3'
18+
19+
describe 'compile script' do
20+
21+
it 'should return non-zero if failure' do
22+
Open3.popen3("bin/compile spec/fixtures/invalid_vendor") do |stdin, stdout, stderr, wait_thr|
23+
expect(wait_thr.value).to_not be_success
24+
expect(stderr.read).to eq("'sun' is not a valid Java runtime vendor\n")
25+
end
26+
end
27+
28+
end

0 commit comments

Comments
 (0)