Debian Codegraph @

tests/functional/runahead/06-release-update.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 that the datastore is updated when runahead tasks are released.
19 # GitHub #1981
20 . "$(dirname "$0")/test_header"
21 set_test_number 3
22 install_workflow "${TEST_NAME_BASE}" 'release-update'
23 #-------------------------------------------------------------------------------
24 run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"
25 cylc play --debug --no-detach "${WORKFLOW_NAME}" 1>'out' 2>&1 &
26 CYLC_RUN_PID="$!"
27 poll_workflow_running
28 YYYY="$(date +%Y)"
29 NEXT1=$(( YYYY + 1 ))
30 poll_grep_workflow_log -E "${NEXT1}/bar.* added to the n=0 window"
31
32 # sleep a little to allow the datastore to update (`cylc dump` sees the
33 # datastore) TODO can we avoid this flaky sleep somehow?
34 sleep 10
35
36 # (gratuitous use of --flows for test coverage)
37 cylc dump -l --flows -t "${WORKFLOW_NAME}" | awk '{print $1 $2 $3 $7}' >'log'
38
39 # The scheduler task pool should contain:
40 # NEXT1/foo - waiting on clock trigger
41 # NEXT1/bar - waiting, partially satisfied
42 # The n=1 data store should also contain:
43 # YYYY/bar - succeeded
44
45 cmp_ok 'log' - <<__END__
46 bar,$NEXT1,waiting,[1]
47 foo,$NEXT1,waiting,[1]
48 __END__
49
50 run_ok "${TEST_NAME_BASE}-stop" \
51 cylc stop --max-polls=10 --interval=6 "${WORKFLOW_NAME}"
52 if ! wait "${CYLC_RUN_PID}" 1>'/dev/null' 2>&1; then
53 cat 'out' >&2
54 fi
55 #-------------------------------------------------------------------------------
56 purge
57 exit