From 0c06fa35cfdbae425591b264d7fe265795e9a44d Mon Sep 17 00:00:00 2001 From: cytopia Date: Thu, 2 Apr 2020 00:07:13 +0200 Subject: [PATCH] SSH integration tests: Fail on stderr warnings --- tests/10-run-remote-default-abs.sh | 22 ++++++++++++++++++---- tests/10-run-remote-default-rel.sh | 22 ++++++++++++++++++---- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/tests/10-run-remote-default-abs.sh b/tests/10-run-remote-default-abs.sh index 894167d..7ee266d 100755 --- a/tests/10-run-remote-default-abs.sh +++ b/tests/10-run-remote-default-abs.sh @@ -13,8 +13,8 @@ FUNCPATH="${SCRIPTPATH}/.lib/functions.sh" ### ### Kill accidentally left artifacts ### -run "docker rm -f ssh-server || true" -run "docker rm -f ssh-client || true" +run "docker rm -f ssh-server || true" >/dev/null 2>&1 +run "docker rm -f ssh-client || true" >/dev/null 2>&1 ### @@ -28,22 +28,36 @@ run "docker run -d --rm --name ssh-client -h client --link ssh-server -v '${SCRI ### Run 1 ### run "sleep 5" -if ! run "docker exec ssh-client /usr/bin/timemachine -d /tests root@server:/backup2"; then +if ! ERR="$( run "docker exec ssh-client /usr/bin/timemachine -d /tests root@server:/backup2" 3>&1 1>&2 2>&3 )"; then run "docker rm -f ssh-server" run "docker rm -f ssh-client" exit 1 fi +if [ -n "${ERR}" ]; then + printf "[TEST] [FAIL] Warnings detected.\\r\\n" + printf "Warnings:\\r\\n----------\\r\\n%s\\r\\n" "${ERR}" + run "docker rm -f ssh-server || true" >/dev/null 2>&1 + run "docker rm -f ssh-client || true" >/dev/null 2>&1 + exit 1 +fi ### ### Run 2 ### run "sleep 5" -if ! run "docker exec ssh-client /usr/bin/timemachine -d /tests root@server:/backup2"; then +if ! ERR="$( run "docker exec ssh-client /usr/bin/timemachine -d /tests root@server:/backup2" 3>&1 1>&2 2>&3 )"; then run "docker rm -f ssh-server" run "docker rm -f ssh-client" exit 1 fi +if [ -n "${ERR}" ]; then + printf "[TEST] [FAIL] Warnings detected.\\r\\n" + printf "Warnings:\\r\\n----------\\r\\n%s\\r\\n" "${ERR}" + run "docker rm -f ssh-server || true" >/dev/null 2>&1 + run "docker rm -f ssh-client || true" >/dev/null 2>&1 + exit 1 +fi ### diff --git a/tests/10-run-remote-default-rel.sh b/tests/10-run-remote-default-rel.sh index cf1c00d..3613dc3 100755 --- a/tests/10-run-remote-default-rel.sh +++ b/tests/10-run-remote-default-rel.sh @@ -13,8 +13,8 @@ FUNCPATH="${SCRIPTPATH}/.lib/functions.sh" ### ### Kill accidentally left artifacts ### -run "docker rm -f ssh-server || true" -run "docker rm -f ssh-client || true" +run "docker rm -f ssh-server || true" >/dev/null 2>&1 +run "docker rm -f ssh-client || true" >/dev/null 2>&1 ### @@ -28,22 +28,36 @@ run "docker run -d --rm --name ssh-client -h client --link ssh-server -v '${SCRI ### Run 1 ### run "sleep 5" -if ! run "docker exec ssh-client /usr/bin/timemachine -d /tests root@server:backup1"; then +if ! ERR="$( run "docker exec ssh-client /usr/bin/timemachine -d /tests root@server:backup1" 3>&1 1>&2 2>&3 )"; then run "docker rm -f ssh-server" run "docker rm -f ssh-client" exit 1 fi +if [ -n "${ERR}" ]; then + printf "[TEST] [FAIL] Warnings detected.\\r\\n" + printf "Warnings:\\r\\n----------\\r\\n%s\\r\\n" "${ERR}" + run "docker rm -f ssh-server || true" >/dev/null 2>&1 + run "docker rm -f ssh-client || true" >/dev/null 2>&1 + exit 1 +fi ### ### Run 2 ### run "sleep 5" -if ! run "docker exec ssh-client /usr/bin/timemachine -d /tests root@server:backup1"; then +if ! ERR="$( run "docker exec ssh-client /usr/bin/timemachine -d /tests root@server:backup1" 3>&1 1>&2 2>&3 )"; then run "docker rm -f ssh-server" run "docker rm -f ssh-client" exit 1 fi +if [ -n "${ERR}" ]; then + printf "[TEST] [FAIL] Warnings detected.\\r\\n" + printf "Warnings:\\r\\n----------\\r\\n%s\\r\\n" "${ERR}" + run "docker rm -f ssh-server || true" >/dev/null 2>&1 + run "docker rm -f ssh-client || true" >/dev/null 2>&1 + exit 1 +fi ###