Skip to content

Commit

Permalink
Fix tests for PHP 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
cytopia committed Aug 4, 2018
1 parent 04a24b6 commit 7902a6a
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 58 deletions.
112 changes: 55 additions & 57 deletions tests/prod/03-test-env-docker_logs-file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,51 +144,49 @@ if [ ! -r "${LOG_DIR_HOST}/php-fpm.error" ]; then
exit 1
fi

###
### PHP 5.2 still does not show any errors
###
if [ "${VERSION}" != "5.2" ]; then
# Ensure no access/error goes to stderr
if run "docker logs ${did} 2>&1 | grep -q 'GET /ok.php'"; then
echo "Error access log string for 'GET /ok.php' found in stderr, but shold go to file"
run "cat ${LOG_DIR_HOST}/php-fpm.access"
run "cat ${LOG_DIR_HOST}/php-fpm.error"
docker_logs "${did}" || true
docker_stop "${ndid}" || true
docker_stop "${did}" || true
rm -rf "${LOG_DIR_HOST}"
rm -rf "${CFG_DIR_HOST}"
rm -rf "${WWW_DIR_HOST}"
echo "Failed"
exit 1
fi
if run "docker logs ${did} 2>&1 | grep -q 'GET /fail.php'"; then
echo "Error access log string for 'GET /fail.php' found in stderr, but should go to file"
run "cat ${LOG_DIR_HOST}/php-fpm.access"
run "cat ${LOG_DIR_HOST}/php-fpm.error"
docker_logs "${did}" || true
docker_stop "${ndid}" || true
docker_stop "${did}" || true
rm -rf "${LOG_DIR_HOST}"
rm -rf "${CFG_DIR_HOST}"
rm -rf "${WWW_DIR_HOST}"
echo "Failed"
exit 1
fi
if run "docker logs ${did} 2>&1 | grep -q '/var/www/default/fail.php'"; then
echo "Error error message found in stderr, but should go to file"
run "cat ${LOG_DIR_HOST}/php-fpm.access"
run "cat ${LOG_DIR_HOST}/php-fpm.error"
docker_logs "${did}" || true
docker_stop "${ndid}" || true
docker_stop "${did}" || true
rm -rf "${LOG_DIR_HOST}"
rm -rf "${CFG_DIR_HOST}"
rm -rf "${WWW_DIR_HOST}"
echo "Failed"
exit 1
fi
# Ensure no access/error goes to stderr
if run "docker logs ${did} 2>&1 | grep -q 'GET /ok.php'"; then
echo "Error access log string for 'GET /ok.php' found in stderr, but shold go to file"
run "cat ${LOG_DIR_HOST}/php-fpm.access"
run "cat ${LOG_DIR_HOST}/php-fpm.error"
docker_logs "${did}" || true
docker_stop "${ndid}" || true
docker_stop "${did}" || true
rm -rf "${LOG_DIR_HOST}"
rm -rf "${CFG_DIR_HOST}"
rm -rf "${WWW_DIR_HOST}"
echo "Failed"
exit 1
fi
if run "docker logs ${did} 2>&1 | grep -q 'GET /fail.php'"; then
echo "Error access log string for 'GET /fail.php' found in stderr, but should go to file"
run "cat ${LOG_DIR_HOST}/php-fpm.access"
run "cat ${LOG_DIR_HOST}/php-fpm.error"
docker_logs "${did}" || true
docker_stop "${ndid}" || true
docker_stop "${did}" || true
rm -rf "${LOG_DIR_HOST}"
rm -rf "${CFG_DIR_HOST}"
rm -rf "${WWW_DIR_HOST}"
echo "Failed"
exit 1
fi
if run "docker logs ${did} 2>&1 | grep -q '/var/www/default/fail.php'"; then
echo "Error error message found in stderr, but should go to file"
run "cat ${LOG_DIR_HOST}/php-fpm.access"
run "cat ${LOG_DIR_HOST}/php-fpm.error"
docker_logs "${did}" || true
docker_stop "${ndid}" || true
docker_stop "${did}" || true
rm -rf "${LOG_DIR_HOST}"
rm -rf "${CFG_DIR_HOST}"
rm -rf "${WWW_DIR_HOST}"
echo "Failed"
exit 1
fi

# PHP-FPM 5.2 does not show access logs
if [ "${VERSION}" != "5.2" ]; then
# Test access and error file for correct content
if ! run "grep -q 'GET /ok.php' ${LOG_DIR_HOST}/php-fpm.access"; then
echo "Error no access log string for 'GET /ok.php' found in: ${LOG_DIR_HOST}/php-fpm.access"
Expand Down Expand Up @@ -216,19 +214,19 @@ if [ "${VERSION}" != "5.2" ]; then
echo "Failed"
exit 1
fi
if ! run "grep -q '/var/www/default/fail.php' ${LOG_DIR_HOST}/php-fpm.error"; then
echo "Error no error message found in: ${LOG_DIR_HOST}/php-fpm.error"
run "cat ${LOG_DIR_HOST}/php-fpm.access"
run "cat ${LOG_DIR_HOST}/php-fpm.error"
docker_logs "${did}" || true
docker_stop "${ndid}" || true
docker_stop "${did}" || true
rm -rf "${LOG_DIR_HOST}"
rm -rf "${CFG_DIR_HOST}"
rm -rf "${WWW_DIR_HOST}"
echo "Failed"
exit 1
fi
fi
if ! run "grep -q '/var/www/default/fail.php' ${LOG_DIR_HOST}/php-fpm.error"; then
echo "Error no error message found in: ${LOG_DIR_HOST}/php-fpm.error"
run "cat ${LOG_DIR_HOST}/php-fpm.access"
run "cat ${LOG_DIR_HOST}/php-fpm.error"
docker_logs "${did}" || true
docker_stop "${ndid}" || true
docker_stop "${did}" || true
rm -rf "${LOG_DIR_HOST}"
rm -rf "${CFG_DIR_HOST}"
rm -rf "${WWW_DIR_HOST}"
echo "Failed"
exit 1
fi


Expand Down
2 changes: 1 addition & 1 deletion tests/prod/07-test-mount-custom_fpm_conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ FLAVOUR="${3}"
############################################################
# Tests
############################################################
if [ "${VERSION}" != "5.2" ]; then
if [ "${VERSION}" = "5.2" ]; then
echo "Skipping tests for PHP 5.2"
exit 0
fi
Expand Down

0 comments on commit 7902a6a

Please sign in to comment.