| 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 broadcasts |
| 19 |
. "$(dirname "$0")/test_header" |
| 20 |
|
| 21 |
set_test_number 5 |
| 22 |
install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}" |
| 23 |
|
| 24 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" |
| 25 |
workflow_run_ok "${TEST_NAME_BASE}-run" \ |
| 26 |
cylc play --no-detach --reference-test "${WORKFLOW_NAME}" |
| 27 |
sort "${WORKFLOW_RUN_DIR}/share/broadcast.log" >'broadcast.log.sorted' |
| 28 |
cmp_ok 'broadcast.ref' 'broadcast.log.sorted' |
| 29 |
|
| 30 |
DB_FILE="${WORKFLOW_RUN_DIR}/log/db" |
| 31 |
NAME='select-broadcast-events.out' |
| 32 |
sqlite3 "${DB_FILE}" \ |
| 33 |
'SELECT change, point, namespace, key, value FROM broadcast_events |
| 34 |
ORDER BY time, change, point, namespace, key' >"${NAME}" |
| 35 |
cmp_ok "${NAME}" <<'__SELECT__' |
| 36 |
+|*|root|[environment]BCAST|ROOT |
| 37 |
+|20100808T00|foo|[environment]BCAST|FOO |
| 38 |
+|*|bar|[environment]BCAST|BAR |
| 39 |
+|20100809T00|baz|[environment]BCAST|BAZ |
| 40 |
+|20100809T00|qux|[environment]BCAST|QUX |
| 41 |
-|20100809T00|qux|[environment]BCAST|QUX |
| 42 |
+|*|wibble|[environment]BCAST|WIBBLE |
| 43 |
-|*|wibble|[environment]BCAST|WIBBLE |
| 44 |
+|*|ENS|[environment]BCAST|ENS |
| 45 |
+|*|ENS1|[environment]BCAST|ENS1 |
| 46 |
+|20100809T00|m2|[environment]BCAST|M2 |
| 47 |
+|*|m7|[environment]BCAST|M7 |
| 48 |
+|*|m8|[environment]BCAST|M8 |
| 49 |
+|*|m9|[environment]BCAST|M9 |
| 50 |
__SELECT__ |
| 51 |
|
| 52 |
NAME='select-broadcast-states.out' |
| 53 |
sqlite3 "${DB_FILE}" \ |
| 54 |
'SELECT point, namespace, key, value FROM broadcast_states |
| 55 |
ORDER BY point, namespace, key' >"${NAME}" |
| 56 |
cmp_ok "${NAME}" <<'__SELECT__' |
| 57 |
*|ENS|[environment]BCAST|ENS |
| 58 |
*|ENS1|[environment]BCAST|ENS1 |
| 59 |
*|bar|[environment]BCAST|BAR |
| 60 |
*|m7|[environment]BCAST|M7 |
| 61 |
*|m8|[environment]BCAST|M8 |
| 62 |
*|m9|[environment]BCAST|M9 |
| 63 |
*|root|[environment]BCAST|ROOT |
| 64 |
20100808T00|foo|[environment]BCAST|FOO |
| 65 |
20100809T00|baz|[environment]BCAST|BAZ |
| 66 |
20100809T00|m2|[environment]BCAST|M2 |
| 67 |
__SELECT__ |
| 68 |
|
| 69 |
purge |
| 70 |
exit |