Debian Codegraph @

tests/f/cli/03-verbosity.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 verbosity"
19 . "$(dirname "$0")/test_header"
20 set_test_number 4
21
22 # Test illegal log level
23 TEST_NAME="${TEST_NAME_BASE}-bad"
24 run_fail "$TEST_NAME" cylc verbosity duck quack
25 grep_ok 'InputError: Illegal logging level, duck' "${TEST_NAME}.stderr"
26
27 # Test good log level
28 TEST_NAME="${TEST_NAME_BASE}-good"
29 init_workflow "${TEST_NAME_BASE}" << '__FLOW__'
30 [scheduler]
31 [[events]]
32 abort on stall timeout = True
33 stall timeout = PT0S
34 [scheduling]
35 [[graph]]
36 R1 = setter => getter
37 [runtime]
38 [[setter]]
39 script = """
40 echo "CYLC_VERBOSE: $CYLC_VERBOSE"
41 [[ "$CYLC_VERBOSE" != 'true' ]]
42 echo "CYLC_DEBUG: $CYLC_DEBUG"
43 [[ "$CYLC_DEBUG" != 'true' ]]
44
45 cylc verbosity DEBUG "$CYLC_WORKFLOW_ID"
46 cylc__job__poll_grep_workflow_log 'Command "set_verbosity" actioned'
47 """
48 [[getter]]
49 script = """
50 echo "CYLC_VERBOSE: $CYLC_VERBOSE"
51 [[ "$CYLC_VERBOSE" == 'true' ]]
52 echo "CYLC_DEBUG: $CYLC_DEBUG"
53 [[ "$CYLC_DEBUG" == 'true' ]]
54 """
55 __FLOW__
56
57 run_ok "${TEST_NAME}-validate" cylc validate "$WORKFLOW_NAME"
58 workflow_run_ok "${TEST_NAME}-run" cylc play --no-detach "$WORKFLOW_NAME"
59 purge