Skip to content

Commit

Permalink
Test redirection of stdout and stderr
Browse files Browse the repository at this point in the history
Change-type: patch
Signed-off-by: Kyle Harding <[email protected]>
  • Loading branch information
klutchell committed Nov 15, 2023
1 parent 4e78146 commit a01e666
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash

# This script is run as the healthcheck command for the VM image and
# the logs are grepped for the exit status message to determine success/fail.
Expand All @@ -21,8 +21,10 @@ uname -a

df -h

echo "Hello, World!" >/dev/stdout
echo "Hello, World!" >/dev/stderr
echo "Testing stdout" >&1
echo "Testing stderr" >&2
echo "Testing stdout" >/dev/stdout
echo "Testing stderr" >/dev/stderr

if [ -n "${HOSTNAME}" ]; then
test "${HOSTNAME}" = "$(hostname)"
Expand All @@ -44,6 +46,8 @@ fi

if command -v npm >/dev/null 2>&1; then
npm ping
node -e "console.log('Testing console.log')" 1> >(tee -a /tmp/stdout)
node -e "console.error('Testing console.error')" 2> >(tee -a /tmp/stderr)
fi

if command -v ping >/dev/null 2>&1; then
Expand Down

0 comments on commit a01e666

Please sign in to comment.