Skip to content

Commit

Permalink
Fix Apache file path and add suite of buildpack-testrunner test
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbrainard committed May 4, 2012
1 parent 286bebe commit 9db64d4
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if [ -f www/Procfile ]; then
mv www/Procfile .
fi

APACHE_URL="$RESOUCE_BASE_URL/apache-$APACHE_VERSION.tar.gz"
APACHE_URL="$RESOURCE_BASE_URL/apache-$APACHE_VERSION.tar.gz"
echo "-----> Bundling Apache version $APACHE_VERSION"
curl --silent --max-time 60 --location "$APACHE_URL" | tar xz

Expand Down
27 changes: 27 additions & 0 deletions test/compile_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

. ${BUILDPACK_TEST_RUNNER_HOME}/lib/test_utils.sh

testCompile() {
touch ${BUILD_DIR}/index.php

compile
assertCapturedSuccess
assertCaptured "Bundling Apache"
assertTrue "Apache should be installed" "[ -d ${BUILD_DIR}/apache ]"
assertTrue "Apache config should be copied" "[ -f ${BUILD_DIR}/apache/conf/httpd.conf ]"
assertTrue "Apache should include mod_expires module" "[ -f ${BUILD_DIR}/apache/modules/mod_expires.so ]"
assertTrue "Apache should include mod_headers module" "[ -f ${BUILD_DIR}/apache/modules/mod_headers.so ]"
assertFileContains "Apache should load include expires_module" "LoadModule expires_module" "${BUILD_DIR}/apache/conf/httpd.conf"
assertFileContains "Apache should load include headers_module" "LoadModule headers_module" "${BUILD_DIR}/apache/conf/httpd.conf"

assertCaptured "Bundling PHP"
assertTrue "PHP should be installed" "[ -d ${BUILD_DIR}/php ]"
assertTrue "PHP config should be copied" "[ -f ${BUILD_DIR}/php/php.ini ]"
assertTrue "PHP should include Redis extension" "[ -f ${BUILD_DIR}/php/ext/redis.so ]"
assertFileContains "PHP should load Redis extension" "extension=redis.so" "${BUILD_DIR}/php/php.ini"

assertTrue "bin dir should be created" "[ -d ${BUILD_DIR}/bin ]"
assertTrue "boot.sh dir should be created and be executable" "[ -x ${BUILD_DIR}/boot.sh ]"
assertEquals "cache should be cleared" "" "$(ls ${CACHE_DIR})"
}
17 changes: 17 additions & 0 deletions test/detect_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

. ${BUILDPACK_TEST_RUNNER_HOME}/lib/test_utils.sh

testNoDetect() {
detect

assertNoAppDetected
}

testDetect_PHP() {
touch ${BUILD_DIR}/index.php

detect

assertAppDetected "PHP"
}
10 changes: 10 additions & 0 deletions test/release_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

. ${BUILDPACK_TEST_RUNNER_HOME}/lib/test_utils.sh

testRelease() {
release

assertCapturedSuccess
assertCaptured "web: sh boot.sh"
}

0 comments on commit 9db64d4

Please sign in to comment.