Debian Codegraph @

tests/functional/events/34-task-abort.t

raw
1 #!/usr/bin/env bash
2 # THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
3 # Copyright (C) NIWA & British Crown (Met Office) & Contributors.
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #-------------------------------------------------------------------------------
18 # Test job abort-with-message and interaction with failed handler.
19 . "$(dirname "$0")/test_header"
20 set_test_number 6
21 install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
22 #-------------------------------------------------------------------------------
23 run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"
24 #-------------------------------------------------------------------------------
25 workflow_run_ok "${TEST_NAME_BASE}-run" \
26 cylc play --reference-test --debug --no-detach "${WORKFLOW_NAME}"
27 #-------------------------------------------------------------------------------
28 # Check failed handler only call on last try.
29 LOG="${WORKFLOW_RUN_DIR}/log/job/1/foo/NN/job-activity.log"
30 grep "event-handler" "${LOG}" > 'edited-job-activity.log'
31 cmp_ok 'edited-job-activity.log' <<'__LOG__'
32 [(('event-handler-00', 'failed'), 2) cmd] echo "!!!FAILED!!!" failed 1/foo 2 '"ERROR: rust never sleeps"'
33 [(('event-handler-00', 'failed'), 2) ret_code] 0
34 [(('event-handler-00', 'failed'), 2) out] !!!FAILED!!! failed 1/foo 2 "ERROR: rust never sleeps"
35 __LOG__
36 #-------------------------------------------------------------------------------
37 # Check job stdout stops at the abort call.
38 LOG="${WORKFLOW_RUN_DIR}/log/job/1/foo/NN/job.out"
39 # ...before abort
40 grep_ok 'ONE' "${LOG}"
41 # ...after abort
42 grep_fail 'TWO' "${LOG}"
43 #-------------------------------------------------------------------------------
44 # Check only one CYLC_JOB_EXIT message written.
45 JOB_STATUS="${WORKFLOW_RUN_DIR}/log/job/1/foo/NN/job.status"
46 run_ok "${TEST_NAME_BASE}-message-count" \
47 test "$(grep -c '^CYLC_JOB_EXIT=' "$JOB_STATUS")" -eq '1'
48 #-------------------------------------------------------------------------------
49 purge
50 exit