Skip to content

Commit

Permalink
Merge pull request #52 from cytopia/ci-ssh-second-run
Browse files Browse the repository at this point in the history
SSH integration tests: Fail on stderr warnings
  • Loading branch information
cytopia authored Apr 1, 2020
2 parents 8e38090 + 447bf1a commit 0933d72
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
22 changes: 18 additions & 4 deletions tests/10-run-remote-default-abs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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


###
Expand All @@ -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


###
Expand Down
22 changes: 18 additions & 4 deletions tests/10-run-remote-default-rel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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


###
Expand All @@ -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


###
Expand Down

0 comments on commit 0933d72

Please sign in to comment.