Debian Codegraph @

tests/functional/restart/52-cycle-point-time-zone.t

raw
1 #!/bin/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 saving and loading of cycle point time zone to/from database on a run
19 # followed by a restart. Important for restarting a workflow after a system
20 # time zone change.
21
22 . "$(dirname "$0")/test_header"
23
24 set_test_number 6
25
26 init_workflow "${TEST_NAME_BASE}" << '__FLOW__'
27 #!jinja2
28 [scheduler]
29 cycle point time zone = {{ CPTZ }}
30 UTC mode = False
31 allow implicit tasks = True
32 [scheduling]
33 initial cycle point = now
34 [[graph]]
35 R1 = foo
36 __FLOW__
37
38 run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" -s "CPTZ='Z'"
39
40 workflow_run_ok "${TEST_NAME_BASE}-run" cylc play "${WORKFLOW_NAME}" --pause -s "CPTZ='+0100'"
41 poll_workflow_running
42 cylc stop "${WORKFLOW_NAME}"
43 poll_workflow_stopped
44
45 sqlite3 "${WORKFLOW_RUN_DIR}/log/db" \
46 "SELECT * FROM workflow_params WHERE key=='cycle_point_tz';" > 'dump.out'
47 cmp_ok 'dump.out' <<< 'cycle_point_tz|+0100'
48
49 # Simulate DST change
50 export TZ=UTC
51
52 workflow_run_ok "${TEST_NAME_BASE}-restart" cylc play "${WORKFLOW_NAME}" --pause
53 poll_workflow_running
54
55 cylc stop "${WORKFLOW_NAME}"
56
57 log_scan "${TEST_NAME_BASE}-log-scan" "${WORKFLOW_RUN_DIR}/log/scheduler/log" 1 0 \
58 'LOADING saved workflow parameters' \
59 '+ cycle point time zone = +0100'
60
61 purge