Skip to content

Commit

Permalink
Merge pull request #178 from bryanlatten/upgrade-cmd-bash
Browse files Browse the repository at this point in the history
Command: fixing bash check for variable
  • Loading branch information
bryanlatten committed Aug 13, 2020
2 parents f86d6bb + e492548 commit d9d1600
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 6 deletions.
11 changes: 6 additions & 5 deletions container/root/etc/services-available/php-fpm/.command
Original file line number Diff line number Diff line change
Expand Up @@ -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


6 changes: 6 additions & 0 deletions runtime-tests/startup/7.0/goss.yaml
Original file line number Diff line number Diff line change
@@ -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/'
6 changes: 6 additions & 0 deletions runtime-tests/startup/7.1/goss.yaml
Original file line number Diff line number Diff line change
@@ -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/'
6 changes: 6 additions & 0 deletions runtime-tests/startup/7.2/goss.yaml
Original file line number Diff line number Diff line change
@@ -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/'
6 changes: 6 additions & 0 deletions runtime-tests/startup/7.3-alpine/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
file:
/goss/docker_output.log:
exists: true
filetype: file # file, symlink, directory
contains: # Check file content for these patterns
- '/launching...$/'
6 changes: 6 additions & 0 deletions runtime-tests/startup/7.3/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
file:
/goss/docker_output.log:
exists: true
filetype: file # file, symlink, directory
contains: # Check file content for these patterns
- '/launching...$/'
6 changes: 6 additions & 0 deletions runtime-tests/startup/7.4/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
file:
/goss/docker_output.log:
exists: true
filetype: file # file, symlink, directory
contains: # Check file content for these patterns
- '/launching...$/'
9 changes: 8 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit d9d1600

Please sign in to comment.