Skip to content

Commit

Permalink
Add test case for RUN_TEST
Browse files Browse the repository at this point in the history
  • Loading branch information
mfojtik committed Jan 3, 2016
1 parent ce039a0 commit 1f377be
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions 2.2/test/puma-test-app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ source 'https://rubygems.org'

gem 'sinatra'
gem 'puma'
gem 'rack'
gem 'rake'
6 changes: 6 additions & 0 deletions 2.2/test/puma-test-app/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ GEM
rack (1.5.2)
rack-protection (1.5.0)
rack
rake (0.9.6)
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
Expand All @@ -17,4 +18,9 @@ PLATFORMS

DEPENDENCIES
puma
rack
rake
sinatra

BUNDLED WITH
1.11.2
8 changes: 8 additions & 0 deletions 2.2/test/puma-test-app/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'bundler'

require 'rake/testtask'

Rake::TestTask.new do |t|
t.pattern = "test/*_test.rb"
t.verbose = true
end
8 changes: 8 additions & 0 deletions 2.2/test/puma-test-app/test/sample_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'bundler'
require 'minitest/autorun'

class TestSample < Minitest::Test
def test_sample
assert_equal "Foo", "Foo"
end
end
10 changes: 9 additions & 1 deletion 2.2/test/run
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ run_s2i_build() {
s2i build ${s2i_args} file://${test_dir}/${1}-test-app ${IMAGE_NAME} ${IMAGE_NAME}-testapp
}

run_s2i_build_with_test() {
s2i build -e RUN_TEST="bundle exec rake test" ${s2i_args} file://${test_dir}/${1}-test-app ${IMAGE_NAME} ${IMAGE_NAME}-testapp
}

prepare() {
if ! image_exists ${IMAGE_NAME}; then
echo "ERROR: The image ${IMAGE_NAME} must exist before this script is executed."
Expand Down Expand Up @@ -161,7 +165,11 @@ for server in ${WEB_SERVERS[@]}; do
s2i_args="--force-pull=false"

prepare ${server}
run_s2i_build ${server}
if [[ "${server}" == "puma" ]]; then
run_s2i_build_with_test ${server}
else
run_s2i_build ${server}
fi
check_result $?

# Verify the 'usage' script is working properly when running the base image with 's2i usage ...'
Expand Down

0 comments on commit 1f377be

Please sign in to comment.