Debian Codegraph @

tests/f/xtriggers/03-sequence.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 xtrigger cycle-point specificity -
19 # https://github.com/cylc/cylc-flow/issues/3283
20
21 . "$(dirname "$0")/test_header"
22
23 set_test_number 2
24
25 # Test workflow uses built-in 'echo' xtrigger.
26 init_workflow "${TEST_NAME_BASE}" << '__FLOW_CONFIG__'
27 [scheduler]
28 cycle point format = %Y
29 [scheduling]
30 initial cycle point = 2025
31 final cycle point = +P1Y
32 [[xtriggers]]
33 e1 = echo(name='bob', succeed=True)
34 e2 = echo(name='alice', succeed=False)
35 [[dependencies]]
36 [[[R1]]]
37 graph = "start"
38 [[[R/^/P2Y]]]
39 graph = "@e1 => foo"
40 [[[R/^+P1Y/P2Y]]]
41 graph = "@e2 => foo"
42 [runtime]
43 [[start]]
44 [[foo]]
45 __FLOW_CONFIG__
46
47 run_ok "${TEST_NAME_BASE}-val" cylc validate "${WORKFLOW_NAME}"
48
49 # Run workflow; it will stall waiting on the never-satisfied xtriggers.
50 cylc play "${WORKFLOW_NAME}"
51
52 poll_grep_workflow_log -E '2025/start.* => succeeded'
53
54 cylc show "${WORKFLOW_NAME}//2026/foo" | grep -E '^ ⨯ xtrigger' > 2026.foo.log
55
56 # 2026/foo should get only xtrigger e2.
57 cmp_ok 2026.foo.log - <<__END__
58 ⨯ xtrigger "e2 = echo(name=alice, succeed=False)"
59 __END__
60
61 cylc stop --now --max-polls=10 --interval=2 "${WORKFLOW_NAME}"
62 purge