From e49254867d7c7d87ce9c393fa30dfd4e4fa42054 Mon Sep 17 00:00:00 2001 From: Bryan Latten Date: Thu, 13 Aug 2020 13:28:03 -0400 Subject: [PATCH] Command: fixing bash check for variable --- .../root/etc/services-available/php-fpm/.command | 11 ++++++----- runtime-tests/startup/7.0/goss.yaml | 6 ++++++ runtime-tests/startup/7.1/goss.yaml | 6 ++++++ runtime-tests/startup/7.2/goss.yaml | 6 ++++++ runtime-tests/startup/7.3-alpine/goss.yaml | 6 ++++++ runtime-tests/startup/7.3/goss.yaml | 6 ++++++ runtime-tests/startup/7.4/goss.yaml | 6 ++++++ test.sh | 9 ++++++++- 8 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 runtime-tests/startup/7.0/goss.yaml create mode 100644 runtime-tests/startup/7.1/goss.yaml create mode 100644 runtime-tests/startup/7.2/goss.yaml create mode 100644 runtime-tests/startup/7.3-alpine/goss.yaml create mode 100644 runtime-tests/startup/7.3/goss.yaml create mode 100644 runtime-tests/startup/7.4/goss.yaml diff --git a/container/root/etc/services-available/php-fpm/.command b/container/root/etc/services-available/php-fpm/.command index f8507e4..df3ab46 100755 --- a/container/root/etc/services-available/php-fpm/.command +++ b/container/root/etc/services-available/php-fpm/.command @@ -3,13 +3,14 @@ # Ensures that a failure of php-fpm doesn't return with a 0, even if the right-hand side does set -o pipefail -# IMPORTANT: PHP 7.3+ optionally allows undecorated stdout/stderr, removing pipe magic requirement -UPGRADE_COMMAND=`grep "decorate_workers_output = no" $CONF_FPMPOOL` +# IMPORTANT: PHP 7.3+ optionally allows undecorated stdout/stderr, removes requirement for legacy post-filtering +grep "decorate_workers_output = no" "$CONF_FPMPOOL" 1>/dev/null +_RETVAL=$? -if [ $UPGRADE_COMMAND ]; then +if [[ "${_RETVAL}" == "0" ]]; then + echo '[php-fpm] launching...' exec php-fpm -F -O else + echo '[php-fpm] launching...with legacy filtered stdout' exec php-fpm -F -O 2>&1 | sed -u 's,.*: \"\(.*\)$,\1,'| sed -u 's,\"$,,' fi - - diff --git a/runtime-tests/startup/7.0/goss.yaml b/runtime-tests/startup/7.0/goss.yaml new file mode 100644 index 0000000..3d3337e --- /dev/null +++ b/runtime-tests/startup/7.0/goss.yaml @@ -0,0 +1,6 @@ +file: + /goss/docker_output.log: + exists: true + filetype: file # file, symlink, directory + contains: # Check file content for these patterns + - '/legacy filtered stdout/' diff --git a/runtime-tests/startup/7.1/goss.yaml b/runtime-tests/startup/7.1/goss.yaml new file mode 100644 index 0000000..3d3337e --- /dev/null +++ b/runtime-tests/startup/7.1/goss.yaml @@ -0,0 +1,6 @@ +file: + /goss/docker_output.log: + exists: true + filetype: file # file, symlink, directory + contains: # Check file content for these patterns + - '/legacy filtered stdout/' diff --git a/runtime-tests/startup/7.2/goss.yaml b/runtime-tests/startup/7.2/goss.yaml new file mode 100644 index 0000000..3d3337e --- /dev/null +++ b/runtime-tests/startup/7.2/goss.yaml @@ -0,0 +1,6 @@ +file: + /goss/docker_output.log: + exists: true + filetype: file # file, symlink, directory + contains: # Check file content for these patterns + - '/legacy filtered stdout/' diff --git a/runtime-tests/startup/7.3-alpine/goss.yaml b/runtime-tests/startup/7.3-alpine/goss.yaml new file mode 100644 index 0000000..7c10162 --- /dev/null +++ b/runtime-tests/startup/7.3-alpine/goss.yaml @@ -0,0 +1,6 @@ +file: + /goss/docker_output.log: + exists: true + filetype: file # file, symlink, directory + contains: # Check file content for these patterns + - '/launching...$/' diff --git a/runtime-tests/startup/7.3/goss.yaml b/runtime-tests/startup/7.3/goss.yaml new file mode 100644 index 0000000..7c10162 --- /dev/null +++ b/runtime-tests/startup/7.3/goss.yaml @@ -0,0 +1,6 @@ +file: + /goss/docker_output.log: + exists: true + filetype: file # file, symlink, directory + contains: # Check file content for these patterns + - '/launching...$/' diff --git a/runtime-tests/startup/7.4/goss.yaml b/runtime-tests/startup/7.4/goss.yaml new file mode 100644 index 0000000..7c10162 --- /dev/null +++ b/runtime-tests/startup/7.4/goss.yaml @@ -0,0 +1,6 @@ +file: + /goss/docker_output.log: + exists: true + filetype: file # file, symlink, directory + contains: # Check file content for these patterns + - '/launching...$/' diff --git a/test.sh b/test.sh index 265a47c..19cedcc 100755 --- a/test.sh +++ b/test.sh @@ -79,7 +79,14 @@ echo "${PREFIX} Send uploaded file" curl --form upload=@tmp.txt "${MACHINE}:${CONTAINER_PORT}" \ | grep "PHP Version ${PHP_VERSION}." > /dev/null -echo "${PREFIX} Perform runtime tests" +echo "${PREFIX} Perform startup tests" +GOSS_PATH=goss \ +GOSS_SLEEP=5 \ +GOSS_FILES_PATH="runtime-tests/startup/${PHP_VARIANT}/" \ +./dgoss run \ + "${DOCKER_TAG}:latest" + +echo "${PREFIX} Perform NewRelic runtime tests" GOSS_PATH=goss \ GOSS_FILES_PATH="runtime-tests/newrelic/${PHP_VARIANT}/" \ ./dgoss run \