Debian Codegraph @

tests/f/spawn-on-demand/02-merge.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
19 # Check that flows merge correctly.
20
21 . "$(dirname "$0")/test_header"
22 install_workflow "${TEST_NAME_BASE}"
23
24 set_test_number 4
25
26 TEST_NAME="${TEST_NAME_BASE}"-validate
27 run_ok "${TEST_NAME}" cylc validate "${WORKFLOW_NAME}"
28
29 TEST_NAME="${TEST_NAME_BASE}"-run
30 workflow_run_ok "${TEST_NAME}" \
31 cylc play --reference-test --debug --no-detach "${WORKFLOW_NAME}"
32
33 # check the DB as well
34 sqlite3 ~/cylc-run/"${WORKFLOW_NAME}"/log/db \
35 "SELECT name, cycle, flow_nums FROM task_states \
36 WHERE submit_num is 1 order by cycle" \
37 > flow-one.db
38
39 cmp_ok flow-one.db - << __OUT__
40 foo|1|[1]
41 bar|1|[1]
42 foo|2|[1]
43 bar|2|[1]
44 foo|3|[1]
45 foo|3|[1, 2]
46 bar|3|[1, 2]
47 __OUT__
48
49 sqlite3 ~/cylc-run/"${WORKFLOW_NAME}"/log/db \
50 "SELECT name, cycle, flow_nums FROM task_states \
51 WHERE submit_num is 2 order by cycle" \
52 > flow-two.db
53
54 cmp_ok flow-two.db - << __OUT__
55 foo|1|[2]
56 bar|1|[2]
57 foo|2|[2]
58 bar|2|[2]
59 __OUT__
60
61 purge
62 exit