Skip to content

Commit

Permalink
Added tests for nginx.conf.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphoting committed Feb 28, 2013
1 parent 5974dec commit 31ce5ea
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/compile_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

. ${BUILDPACK_HOME}/support/set-env.sh

assertCapturedOnStdErr()
{
assertFileContains "$@" "${STD_ERR}"
}

testCompile()
{
compile
Expand Down Expand Up @@ -49,6 +54,24 @@ testCompile()
assertCaptured "-----> Done with compile"
}

testCompiledConfig()
{
compile

# Test erb generation
[ -z "`which erb`" ] && startSkipping
PORT=3000 erb "${BUILD_DIR}/vendor/nginx/conf/nginx.conf.erb" > "${BUILD_DIR}/vendor/nginx/conf/nginx.conf"
assertTrue "port substituted" "[ `grep -c '<%= ENV['PORT'] %>' ${BUILD_DIR}/vendor/nginx/conf/nginx.conf` -eq 0 ]"

[ "`uname -m`" != "x86_64" ] && startSkipping
# disable error log in config file
#sed -i '/error_log*/ s/^/#/' ${BUILD_DIR}/vendor/nginx/conf/nginx.conf
# Test nginx config file
capture ${BUILD_DIR}/vendor/nginx/sbin/nginx -t -c ${BUILD_DIR}/vendor/nginx/conf/nginx.conf
assertCapturedOnStdErr "syntax is ok"
#cat ${STD_ERR}
}

testCachedCompile()
{
compile
Expand Down

0 comments on commit 31ce5ea

Please sign in to comment.