Debian Codegraph @

tests/k/cylc-show/00-simple.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 cylc show for a basic task.
19 . "$(dirname "$0")/test_header"
20
21 #-------------------------------------------------------------------------------
22 set_test_number 8
23 #-------------------------------------------------------------------------------
24 install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
25 #-------------------------------------------------------------------------------
26 TEST_SHOW_OUTPUT_PATH="${PWD}/${TEST_NAME_BASE}-show"
27 #-------------------------------------------------------------------------------
28 TEST_NAME="${TEST_NAME_BASE}-validate"
29 run_ok "${TEST_NAME}" cylc validate \
30 --set="TEST_OUTPUT_PATH='${TEST_SHOW_OUTPUT_PATH}'" "${WORKFLOW_NAME}"
31 #-------------------------------------------------------------------------------
32 TEST_NAME="${TEST_NAME_BASE}-run"
33 workflow_run_ok "${TEST_NAME}" cylc play --reference-test --debug --no-detach \
34 --set="TEST_OUTPUT_PATH='${TEST_SHOW_OUTPUT_PATH}'" "${WORKFLOW_NAME}"
35 #-------------------------------------------------------------------------------
36 TEST_NAME="${TEST_NAME_BASE}-show"
37 cmp_ok "${TEST_NAME}-workflow" <<'__SHOW_OUTPUT__'
38 title: a test workflow
39 description: the quick brown fox
40 custom: custard
41 URL: (not given)
42 __SHOW_OUTPUT__
43
44 cmp_ok "${TEST_NAME}-task" <<'__SHOW_OUTPUT__'
45 title: a task
46 description: jumped over the lazy dog
47 baz: pub
48 URL: (not given)
49 __SHOW_OUTPUT__
50
51 cmp_ok "${TEST_NAME}-taskinstance" <<'__SHOW_OUTPUT__'
52 title: a task
53 description: jumped over the lazy dog
54 baz: pub
55 URL: (not given)
56 state: running
57 prerequisites: ('⨯': not satisfied)
58 ✓ 20141106T0900Z/bar succeeded
59 outputs: ('⨯': not completed)
60 ⨯ 20141106T0900Z/foo expired
61 ✓ 20141106T0900Z/foo submitted
62 ⨯ 20141106T0900Z/foo submit-failed
63 ✓ 20141106T0900Z/foo started
64 ⨯ 20141106T0900Z/foo succeeded
65 ⨯ 20141106T0900Z/foo failed
66 output completion: incomplete
67 ┆ (
68 ✓ ┆ started
69 ⨯ ┆ and succeeded
70 ┆ )
71 __SHOW_OUTPUT__
72 #-------------------------------------------------------------------------------
73 TEST_NAME="${TEST_NAME_BASE}-show-json"
74 cmp_json "${TEST_NAME}-workflow" "${TEST_NAME}-workflow" <<'__SHOW_OUTPUT__'
75 {
76 "title": "a test workflow",
77 "description": "the quick brown fox",
78 "URL": "",
79 "custom": "custard"
80 }
81 __SHOW_OUTPUT__
82
83 cmp_json "${TEST_NAME}-task" "${TEST_NAME}-task" <<'__SHOW_OUTPUT__'
84 {
85 "foo": {
86 "title": "a task",
87 "description": "jumped over the lazy dog",
88 "URL": "",
89 "baz": "pub"
90 }
91 }
92 __SHOW_OUTPUT__
93
94 cmp_json "${TEST_NAME}-taskinstance" "${TEST_NAME}-taskinstance" \
95 <<__SHOW_OUTPUT__
96 {
97 "20141106T0900Z/foo": {
98 "name": "foo",
99 "id": "~${USER}/${WORKFLOW_NAME}//20141106T0900Z/foo",
100 "cyclePoint": "20141106T0900Z",
101 "state": "running",
102 "isHeld": false,
103 "isQueued": false,
104 "isRunahead": false,
105 "flowNums": "[1]",
106 "task": {
107 "meta": {
108 "title": "a task",
109 "description": "jumped over the lazy dog",
110 "URL": "",
111 "userDefined": {
112 "baz": "pub"
113 }
114 }
115 },
116 "runtime": {
117 "completion": "(started and succeeded)",
118 "runMode": "Live"
119 },
120 "prerequisites": [
121 {
122 "expression": "0",
123 "conditions": [
124 {
125 "exprAlias": "0",
126 "taskId": "20141106T0900Z/bar",
127 "reqState": "succeeded",
128 "message": "satisfied naturally",
129 "satisfied": true
130 }
131 ],
132 "satisfied": true
133 }
134 ],
135 "outputs": [
136 {"label": "expired", "message": "expired", "satisfied": false},
137 {"label": "submitted", "message": "submitted", "satisfied": true},
138 {"label": "submit-failed", "message": "submit-failed", "satisfied": false},
139 {"label": "started", "message": "started", "satisfied": true},
140 {"label": "succeeded", "message": "succeeded", "satisfied": false},
141 {"label": "failed", "message": "failed", "satisfied": false}
142 ],
143 "externalTriggers": [],
144 "xtriggers": []
145 }
146 }
147 __SHOW_OUTPUT__
148 #-------------------------------------------------------------------------------
149 purge
150 exit