Skip to content

Commit

Permalink
Undo some over-zealous changes to tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim committed Nov 9, 2023
1 parent bdb53be commit b7de310
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 51 deletions.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ classifiers =
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: Implementation :: CPython
Topic :: Scientific/Engineering :: Atmospheric Science
Expand Down
24 changes: 10 additions & 14 deletions tests/functional/events/09-task-event-mail.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
if ! command -v mail 2>'/dev/null'; then
skip_all '"mail" command not available'
fi
set_test_number 6
set_test_number 5
mock_smtpd_init
OPT_SET=
if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then
Expand Down Expand Up @@ -49,20 +49,16 @@ run_ok "${TEST_NAME_BASE}-validate" \
workflow_run_ok "${TEST_NAME_BASE}-run" \
cylc play --reference-test --debug --no-detach ${OPT_SET} "${WORKFLOW_NAME}"

grep_ok 'retry: 1/t1/01' "${TEST_SMTPD_LOG}"
grep_ok 'succeeded: 1/t1/02' "${TEST_SMTPD_LOG}"
grep_ok "see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/" "${TEST_SMTPD_LOG}"
cat $TEST_SMTPD_LOG > /home/h02/tpilling/foo
contains_ok "${TEST_SMTPD_LOG}" <<__LOG__
retry: 1/t1/01
succeeded: 1/t1/02
see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/
__LOG__

grep 'Subject:' "${TEST_SMTPD_LOG}" -A1 > selection.log

cmp_ok selection.log <<__HERE__
Subject: [1/t1/01 retry]
${WORKFLOW_NAME}
--
Subject: [1/t1/02 succeeded]
${WORKFLOW_NAME}
__HERE__
run_ok "${TEST_NAME_BASE}-grep-log" \
grep -qPizo "Subject: \[1/t1/01 retry\]\n ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}"
run_ok "${TEST_NAME_BASE}-grep-log" \
grep -qPizo "Subject: \[1/t1/02 succeeded\]\n ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}"

purge
mock_smtpd_kill
Expand Down
12 changes: 8 additions & 4 deletions tests/functional/events/18-workflow-event-mail.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
if ! command -v mail 2>'/dev/null'; then
skip_all '"mail" command not available'
fi
set_test_number 7
set_test_number 3
mock_smtpd_init
OPT_SET=
if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then
Expand Down Expand Up @@ -48,9 +48,13 @@ run_ok "${TEST_NAME_BASE}-validate" \
workflow_run_ok "${TEST_NAME_BASE}-run" \
cylc play --reference-test --debug --no-detach ${OPT_SET} "${WORKFLOW_NAME}"

for searchterm in 'event: startup' 'message: workflow starting' 'event: shutdown' 'message: AUTOMATIC' "see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/"; do
grep_ok "$searchterm" "$TEST_SMTPD_LOG"
done
contains_ok "${TEST_SMTPD_LOG}" <<__LOG__
event: startup
message: workflow starting
event: shutdown
message: AUTOMATIC
see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/
__LOG__

purge
mock_smtpd_kill
Expand Down
17 changes: 9 additions & 8 deletions tests/functional/events/29-task-event-mail-1.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
if ! command -v mail 2>'/dev/null'; then
skip_all '"mail" command not available'
fi
set_test_number 5
set_test_number 4

mock_smtpd_init
create_test_global_config "
Expand All @@ -37,15 +37,16 @@ run_ok "${TEST_NAME_BASE}-validate" \
workflow_run_ok "${TEST_NAME_BASE}-run" \
cylc play --reference-test --debug --no-detach "$WORKFLOW_NAME"

grep_ok "retry: 1/t1/01" "${TEST_SMTPD_LOG}"
grep_ok "see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/" "${TEST_SMTPD_LOG}"

grep 'Subject:' "${TEST_SMTPD_LOG}" -A1 > selection.log
contains_ok "${TEST_SMTPD_LOG}" <<__LOG__
retry: 1/t1/01
see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/
__LOG__

cmp_ok selection.log <<__HERE__
Subject: [1/t1/01 retry]
${WORKFLOW_NAME}
__HERE__
cat ${TEST_SMTPD_LOG} > ${HOME}/foo

run_ok "${TEST_NAME_BASE}-grep-log" \
grep -qPizo "Subject: \[1/t1/01 retry\]\n ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}"

purge
mock_smtpd_kill
Expand Down
47 changes: 22 additions & 25 deletions tests/functional/events/30-task-event-mail-2.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
if ! command -v mail 2>'/dev/null'; then
skip_all '"mail" command not available'
fi
set_test_number 36
set_test_number 5
mock_smtpd_init
OPT_SET=
if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then
Expand Down Expand Up @@ -49,33 +49,30 @@ run_ok "${TEST_NAME_BASE}-validate" \
workflow_run_fail "${TEST_NAME_BASE}-run" \
cylc play --reference-test --debug --no-detach ${OPT_SET} "${WORKFLOW_NAME}"

labels=(
'retry: 1/t1/01'
'retry: 1/t2/01'
'retry: 1/t3/01'
'retry: 1/t4/01'
'retry: 1/t5/01'
'retry: 1/t1/02'
'retry: 1/t2/02'
'retry: 1/t3/02'
'retry: 1/t4/02'
'retry: 1/t5/02'
'failed: 1/t1/03'
'failed: 1/t2/03'
'failed: 1/t3/03'
'failed: 1/t4/03'
'failed: 1/t5/03'
"see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/")

for label in ${labels[@]}; do
grep_ok "$label" "${TEST_SMTPD_LOG}"
done
contains_ok "${TEST_SMTPD_LOG}" <<__LOG__
retry: 1/t1/01
retry: 1/t2/01
retry: 1/t3/01
retry: 1/t4/01
retry: 1/t5/01
retry: 1/t1/02
retry: 1/t2/02
retry: 1/t3/02
retry: 1/t4/02
retry: 1/t5/02
failed: 1/t1/03
failed: 1/t2/03
failed: 1/t3/03
failed: 1/t4/03
failed: 1/t5/03
see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/
__LOG__

run_ok "${TEST_NAME_BASE}-grep-log" \
grep -q "Subject: \\[. tasks retry\\]" "${TEST_SMTPD_LOG}"
grep -qPizo "Subject: \[. tasks retry\]\n ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}"
run_ok "${TEST_NAME_BASE}-grep-log" \
grep -q "Subject: \\[. tasks failed\\]" "${TEST_SMTPD_LOG}"
grep -qPizo "Subject: \[. tasks failed\]\n ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}"

purge
purge
mock_smtpd_kill
exit

0 comments on commit b7de310

Please sign in to comment.