Debian Codegraph @

tests/functional/events/11-cycle-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 fs:indep'
21 . "$(dirname "$0")/test_header"
22 set_test_number 3
23
24 install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
25
26 TEST_PLATFORM_CFG=$(cylc config -i "[platforms][$CYLC_TEST_PLATFORM]")
27
28 create_test_global_config '' "
29 [platforms]
30 [[_retrieve, _no_retrieve]]
31 $TEST_PLATFORM_CFG
32 [[_retrieve]]
33 retrieve job logs = True
34 [[_no_retrieve]]
35 retrieve job logs = False
36 "
37
38 run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"
39 workflow_run_ok "${TEST_NAME_BASE}-run" \
40 cylc play --reference-test --debug --no-detach "${WORKFLOW_NAME}"
41
42 # There are 2 remote tasks. One with "retrieve job logs = True", one without.
43 # Only y should have job.err and job.out retrieved.
44
45 sed "/'job-logs-retrieve'/!d" \
46 "${WORKFLOW_RUN_DIR}/log/job/1/"{y,n}'/'{01,02}'/job-activity.log' \
47 >'edited-activities.log'
48 cmp_ok 'edited-activities.log' <<__LOG__
49 [(('job-logs-retrieve', 'retry'), 1) ret_code] 0
50 [(('job-logs-retrieve', 'succeeded'), 2) ret_code] 0
51 __LOG__
52
53 purge