Skip to content

Commit 43e0f4a

Browse files
committed
output of playbook test is now stored in a log file.
1 parent 5cb0593 commit 43e0f4a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tests/log/.gitkeep

Whitespace-only changes.

tests/test_idempotence.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ GREEN='\033[0;32m'
3030
RED='\033[0;31m'
3131
# SGR code to set text color (foreground) to no color.
3232
NC='\033[0m'
33+
# the logfile to hold the output of the playbook run
34+
LOGFILE="log/${box}_${VIRTUALENV_NAME}.log"
3335

34-
echo "[INFO] $VIRTUALENV_NAME running idempotence test..."
35-
ansible-playbook -i ${INVENTORY} --limit ${box} ${PLAYBOOK} | \
36+
echo "[INFO] ${VIRTUALENV_NAME} running idempotence test..."
37+
ansible-playbook -i ${INVENTORY} --limit ${box} ${PLAYBOOK} 2>&1 | tee ${LOGFILE} | \
3638
grep "${box}" | grep -q "${PASS_CRITERIA}" && \
37-
echo -ne "[TEST] ${box} $VIRTUALENV_NAME idempotence : ${GREEN}PASS${NC}\n" || \
38-
(echo -ne "[TEST] ${box} $VIRTUALENV_NAME idempotence : ${RED}FAILED${NC} ${PASS_CRITERIA}\n" && exit 1)
39+
echo -ne "[TEST] ${box} ${VIRTUALENV_NAME} idempotence : ${GREEN}PASS${NC}\n" || \
40+
(echo -ne "[TEST] ${box} ${VIRTUALENV_NAME} idempotence : ${RED}FAILED${NC} ${PASS_CRITERIA}\n" && exit 1)

0 commit comments

Comments
 (0)