Debian Codegraph @

tests/functional/events/10-task-event-job-logs-retrieve.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 remote job logs retrieval, requires compatible version of cylc on remote
19 # job host.
20 export REQUIRE_PLATFORM='loc:remote'
21 . "$(dirname "$0")/test_header"
22 set_test_number 4
23 OPT_SET=
24 create_test_global_config "" "
25 [platforms]
26 [[${CYLC_TEST_PLATFORM}]]
27 retrieve job logs = True
28 retrieve job logs retry delays = PT5S
29 "
30 OPT_SET='-s GLOBALCFG=True'
31
32 install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
33
34 # shellcheck disable=SC2086
35 run_ok "${TEST_NAME_BASE}-validate" \
36 cylc validate ${OPT_SET} \
37 -s "PLATFORM='${CYLC_TEST_PLATFORM}'" "${WORKFLOW_NAME}"
38 # shellcheck disable=SC2086
39 workflow_run_ok "${TEST_NAME_BASE}-run" \
40 cylc play --reference-test --debug --no-detach ${OPT_SET} \
41 -s "PLATFORM='${CYLC_TEST_PLATFORM}'" "${WORKFLOW_NAME}"
42
43 sed "/'job-logs-retrieve'/!d" \
44 "${WORKFLOW_RUN_DIR}/log/job/1/t1/"{01,02,03}"/job-activity.log" \
45 >'edited-activities.log'
46 cmp_ok 'edited-activities.log' <<'__LOG__'
47 [(('job-logs-retrieve', 'retry'), 1) ret_code] 0
48 [(('job-logs-retrieve', 'retry'), 2) ret_code] 0
49 [(('job-logs-retrieve', 'succeeded'), 3) ret_code] 0
50 __LOG__
51
52 grep -F 'will run after' "${WORKFLOW_RUN_DIR}/log/scheduler/log" \
53 | cut -d' ' -f 4-12 | sort >"edited-log"
54 cmp_ok 'edited-log' <<'__LOG__'
55 1/t1/01 handler:job-logs-retrieve for task event:retry will run after PT5S
56 1/t1/02 handler:job-logs-retrieve for task event:retry will run after PT5S
57 1/t1/03 handler:job-logs-retrieve for task event:succeeded will run after PT5S
58 __LOG__
59
60 purge
61 exit