| 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 deprecated batch_sys_job_id & batch_sys_name event handler template vars |
| 19 |
# - they should still work but give a validation warning |
| 20 |
|
| 21 |
. "$(dirname "$0")/test_header" |
| 22 |
set_test_number 7 |
| 23 |
|
| 24 |
init_workflow "${TEST_NAME_BASE}" << __FLOW__ |
| 25 |
[scheduling] |
| 26 |
[[graph]] |
| 27 |
R1 = foo |
| 28 |
[runtime] |
| 29 |
[[foo]] |
| 30 |
[[[events]]] |
| 31 |
started handlers = \ |
| 32 |
echo "job_id = %(batch_sys_job_id)s; job_runner_name = %(batch_sys_name)s; workflow = %(suite)s; workflow_uuid = %(suite_uuid)s" |
| 33 |
__FLOW__ |
| 34 |
|
| 35 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" |
| 36 |
|
| 37 |
grep_ok 'WARNING - The event handler template variable "%(batch_sys_job_id)s" is deprecated - use "%(job_id)s" instead' \ |
| 38 |
"${TEST_NAME_BASE}-validate.stderr" -F |
| 39 |
grep_ok 'WARNING - The event handler template variable "%(batch_sys_name)s" is deprecated - use "%(job_runner_name)s" instead' \ |
| 40 |
"${TEST_NAME_BASE}-validate.stderr" -F |
| 41 |
grep_ok 'WARNING - The event handler template variable "%(suite)s" is deprecated - use "%(workflow)s" instead' \ |
| 42 |
"${TEST_NAME_BASE}-validate.stderr" -F |
| 43 |
grep_ok 'WARNING - The event handler template variable "%(suite_uuid)s" is deprecated - use "%(uuid)s" instead' \ |
| 44 |
"${TEST_NAME_BASE}-validate.stderr" -F |
| 45 |
|
| 46 |
workflow_run_ok "${TEST_NAME_BASE}-run" cylc play --no-detach "${WORKFLOW_NAME}" |
| 47 |
|
| 48 |
FOO_ACTIVITY_LOG="${WORKFLOW_RUN_DIR}/log/job/1/foo/NN/job-activity.log" |
| 49 |
grep_ok "\[(('event-handler-00', 'started'), 1) out\] job_id = [0-9]\+; job_runner_name = background; workflow = ${WORKFLOW_NAME}; workflow_uuid = [a-f0-9\-]\+" "$FOO_ACTIVITY_LOG" |
| 50 |
|
| 51 |
purge |
| 52 |
exit |