Debian Codegraph @

tests/f/restart/58-waiting-manual-triggered.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 #-------------------------------------------------------------------------------
19 # Test that a task manually triggered just before shutdown will run on restart.
20
21 . "$(dirname "$0")/test_header"
22
23 set_test_number 6
24
25 install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
26
27 run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"
28
29 workflow_run_ok "${TEST_NAME_BASE}-run" cylc play --no-detach "${WORKFLOW_NAME}"
30
31 DB_FILE="${WORKFLOW_RUN_DIR}/log/db"
32
33 # It should have shut down with 2/foo waiting with the is_manual_submit flag on.
34 TEST_NAME="${TEST_NAME_BASE}-db-task-states"
35 QUERY="SELECT status, is_manual_submit FROM task_states WHERE cycle IS 2 AND flow_nums is '[1]';"
36 run_ok "$TEST_NAME" sqlite3 "$DB_FILE" "$QUERY"
37 cmp_ok "${TEST_NAME}.stdout" << '__EOF__'
38 waiting|1
39 __EOF__
40
41 # It should restart and shut down normally, not stall with 2/foo waiting on 1/foo.
42 workflow_run_ok "${TEST_NAME_BASE}-restart" cylc play --no-detach "${WORKFLOW_NAME}"
43
44 # Check that 2/foo job 02 did run before shutdown.
45 grep_workflow_log_ok "${TEST_NAME_BASE}-grep" "\[2\/foo\/02:running\] => succeeded"
46
47 purge
48 exit