Debian Codegraph @

tests/functional/restart/56-db-saves-type.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 restarting a simple workflow with a task still running (orphaned)
19 . "$(dirname "$0")/test_header"
20 set_test_number 3
21 init_workflow "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__'
22 #!Jinja2
23
24 {{ assert(a_str == 'foo', 'variable "a_str" was not a string') }}
25 {{ assert(an_int == 24, 'variable "an_int" was not an int') }}
26 {{ assert(a_float == 1.1111, 'variable "a_float" was not a float') }}
27 {{ assert(complex == {'foo': [True, 42, 'string']}, 'Complex variable did not validate')}}
28
29
30 [scheduler]
31 allow implicit tasks = True
32 [scheduling]
33 [[graph]]
34 R1 = foo
35 __FLOW_CONFIG__
36
37
38 #-------------------------------------------------------------------------------
39 run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" \
40 --set "a_str='foo'" --set "an_int=24" --set "a_float=1.1111" --set "complex={'foo': [True, 42, 'string']}"
41
42 workflow_run_ok "${TEST_NAME_BASE}-run" \
43 cylc play --debug "${WORKFLOW_NAME}" --pause\
44 --set "a_str='foo'" --set "an_int=24" --set "a_float=1.1111" --set "complex={'foo': [True, 42, 'string']}"
45
46 sqlite3 "${WORKFLOW_RUN_DIR}/log/db" 'SELECT * FROM workflow_template_vars' >'sqlite3.out'
47
48 cylc stop --max-polls=10 --interval=2 "${WORKFLOW_NAME}"
49
50 workflow_run_ok "${TEST_NAME_BASE}-restart" \
51 cylc play --debug --no-detach "${WORKFLOW_NAME}"
52 #-------------------------------------------------------------------------------
53 purge
54 exit