Debian Codegraph @

tests/functional/rnd/05-main-loop.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 the development main-loop plugins to ensure they can run to completion
19
20 . "$(dirname "$0")/test_header"
21
22 expected_log_files=(
23 # these are the files they should produce
24 cylc.flow.main_loop.log_data_store.json
25 cylc.flow.main_loop.log_data_store.pdf
26 cylc.flow.main_loop.log_db.sql
27 cylc.flow.main_loop.log_main_loop.json
28 cylc.flow.main_loop.log_main_loop.pdf
29 cylc.flow.main_loop.log_memory.json
30 cylc.flow.main_loop.log_memory.pdf
31 )
32
33 set_test_number $(( 1 + ${#expected_log_files[@]} ))
34
35 init_workflow "${TEST_NAME_BASE}" <<__FLOW_CYLC__
36 [scheduler]
37 # make sure periodic plugins actually run
38 [[main loop]]
39 [[[log data store]]]
40 interval = PT1S
41 [[[log main loop]]]
42 interval = PT1S
43 [[[log memory]]]
44 interval = PT1S
45
46 [scheduling]
47 [[graph]]
48 R1 = a
49
50 [runtime]
51 [[a]]
52 script = sleep 5
53 __FLOW_CYLC__
54
55 # run a workflow with all the development main-loop plugins turned on
56 run_ok "${TEST_NAME_BASE}-run" \
57 cylc play "${WORKFLOW_NAME}" \
58 --no-detach \
59 --debug \
60 --main-loop 'log data store' \
61 --main-loop 'log db' \
62 --main-loop 'log main loop' \
63 --main-loop 'log memory'
64
65 # check the expected files are generated
66 for log_file in "${expected_log_files[@]}"; do
67 file_path="${HOME}/cylc-run/${WORKFLOW_NAME}/${log_file}"
68 run_ok "${TEST_NAME_BASE}.${log_file}" \
69 stat "${file_path}"
70 done
71
72 purge