Debian Codegraph @

tests/functional/workflow-state/08-integer.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 . "$(dirname "$0")/test_header"
19
20 set_test_number 15
21
22 install_workflow "${TEST_NAME_BASE}" integer
23
24 # run one cycle
25 TEST_NAME="${TEST_NAME_BASE}_run_1"
26 workflow_run_ok "${TEST_NAME}" cylc play --debug --no-detach --stopcp=1 "${WORKFLOW_NAME}"
27
28 # too many args
29 TEST_NAME="${TEST_NAME_BASE}_cl_error"
30 run_fail "${TEST_NAME}" cylc workflow-state --max-polls=1 "${WORKFLOW_NAME}-a" "${WORKFLOW_NAME}-b"
31
32 TEST_NAME="${TEST_NAME_BASE}_check_1_status"
33 run_ok "${TEST_NAME}" cylc workflow-state --max-polls=1 "${WORKFLOW_NAME}"
34
35 contains_ok "${TEST_NAME}.stdout" <<__END__
36 2/foo:waiting
37 1/foo:succeeded
38 1/bar:succeeded
39 __END__
40
41 TEST_NAME="${TEST_NAME_BASE}_check_1_outputs"
42 run_ok "${TEST_NAME}" cylc workflow-state --max-polls=1 --triggers "${WORKFLOW_NAME}"
43
44 contains_ok "${TEST_NAME}.stdout" <<__END__
45 1/foo:{'submitted': 'submitted', 'started': 'started', 'succeeded': 'succeeded', 'x': 'hello'}
46 2/foo:{}
47 1/bar:{'submitted': 'submitted', 'started': 'started', 'succeeded': 'succeeded'}
48 __END__
49
50 TEST_NAME="${TEST_NAME_BASE}_poll_fail"
51 run_fail "${TEST_NAME}" cylc workflow-state --max-polls=2 --interval=1 "${WORKFLOW_NAME}//2/foo:succeeded"
52
53 contains_ok "${TEST_NAME}.stderr" <<__END__
54 ERROR - failed after 2 polls
55 __END__
56
57 # finish the run
58 TEST_NAME="${TEST_NAME_BASE}_run_2"
59 workflow_run_ok "${TEST_NAME}" cylc play --debug --no-detach "${WORKFLOW_NAME}"
60
61 TEST_NAME="${TEST_NAME_BASE}_poll_succeed"
62 run_ok "${TEST_NAME}" cylc workflow-state --max-polls=1 "${WORKFLOW_NAME}//2/foo:succeeded"
63
64 contains_ok "${TEST_NAME}.stdout" <<__END__
65 2/foo:succeeded
66 __END__
67
68 TEST_NAME="${TEST_NAME_BASE}_int_offset"
69 run_ok "${TEST_NAME}" cylc workflow-state --max-polls=1 "${WORKFLOW_NAME}//1/foo:succeeded" --offset=P1
70
71 contains_ok "${TEST_NAME}.stdout" <<__END__
72 2/foo:succeeded
73 __END__
74
75 TEST_NAME="${TEST_NAME_BASE}_wildcard_offset"
76 run_fail "${TEST_NAME}" cylc workflow-state --max-polls=1 "${WORKFLOW_NAME}//*/foo:succeeded" --offset=P1
77
78 contains_ok "${TEST_NAME}.stderr" <<__END__
79 InputError: Cycle point "*" is not compatible with an offset.
80 __END__
81
82 purge