Skip to content

Commit

Permalink
Update workflow-state func tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Apr 21, 2024
1 parent 78d228c commit 113942b
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 91 deletions.
5 changes: 3 additions & 2 deletions cylc/flow/scripts/workflow_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ def get_option_parser() -> COP:
action="store", dest="status", default=None, choices=statuses)

parser.add_option(
"-O", "--output", metavar="OUTPUT",
help="Check for a given task output.",
"-O", "--output", "--message", metavar="OUTPUT",
help="Check for a given task output"
" (--message is deprecated and aliased to task output)",
action="store", dest="output", default=None)

parser.add_option(
Expand Down
4 changes: 2 additions & 2 deletions tests/flakyfunctional/events/44-timeout.t
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ __END__
cylc workflow-state "${WORKFLOW_NAME}" >'workflow-state.log'

contains_ok 'workflow-state.log' << __END__
stopper, 1, succeeded
foo, 1, succeeded
stopper, 1, succeeded, [1]
foo, 1, succeeded, [1]
__END__

purge
Expand Down
8 changes: 4 additions & 4 deletions tests/flakyfunctional/xtriggers/01-workflow_state.t
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ grep_ok 'WARNING - inactivity timer timed out after PT20S' "${WORKFLOW_LOG}"
# ... with 2016/foo succeeded and 2016/FAM waiting.
cylc workflow-state -p '2016' "${WORKFLOW_NAME}" >'workflow_state.out'
contains_ok 'workflow_state.out' << __END__
foo, 2016, succeeded
f3, 2016, waiting
f1, 2016, waiting
f2, 2016, waiting
foo, 2016, succeeded, [1]
f3, 2016, waiting, [1]
f1, 2016, waiting, [1]
f2, 2016, waiting, [1]
__END__

# Check broadcast of xtrigger outputs to dependent tasks.
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/job-submission/16-timeout.t
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ __END__
cylc workflow-state "${WORKFLOW_NAME}" > workflow-state.log

contains_ok workflow-state.log << __END__
stopper, 1, succeeded
foo, 1, submit-failed
stopper, 1, succeeded, [1]
foo, 1, submit-failed, [1]
__END__

purge
8 changes: 4 additions & 4 deletions tests/functional/reload/22-remove-task-cycling.t
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ workflow_run_ok "${TEST_NAME}" cylc play --debug --no-detach "${WORKFLOW_NAME}"
TEST_NAME="${TEST_NAME_BASE}-result"
cylc workflow-state "${WORKFLOW_NAME}" > workflow-state.log
contains_ok workflow-state.log << __END__
foo, 1, succeeded
bar, 1, succeeded
foo, 2, succeeded
foo, 3, succeeded
foo, 1, succeeded, [1]
bar, 1, succeeded, [1]
foo, 2, succeeded, [1]
foo, 3, succeeded, [1]
__END__

purge
34 changes: 0 additions & 34 deletions tests/functional/workflow-state/05-message.t

This file was deleted.

34 changes: 34 additions & 0 deletions tests/functional/workflow-state/05-output.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# Test cylc workflow-state for outputs (as opposed to statuses)
. "$(dirname "$0")/test_header"

set_test_number 2

install_workflow "${TEST_NAME_BASE}" output

TEST_NAME="${TEST_NAME_BASE}-run"
workflow_run_ok "${TEST_NAME}" \
cylc play --reference-test --debug --no-detach "${WORKFLOW_NAME}"

TEST_NAME=${TEST_NAME_BASE}-cli-check
run_ok "${TEST_NAME}" cylc workflow-state "${WORKFLOW_NAME}" \
-p 20100101T0000Z --output=hello --task=t1 --max-polls=1


purge
19 changes: 9 additions & 10 deletions tests/functional/workflow-state/06-format.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------

# Test "cylc workflow-state" cycle point format conversion, when the target workflow
# sets an explicit cycle point format, and the CLI does not.
. "$(dirname "$0")/test_header"
#-------------------------------------------------------------------------------

set_test_number 5
#-------------------------------------------------------------------------------

init_workflow "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__'
[scheduler]
UTC mode = True
Expand All @@ -33,23 +33,22 @@ init_workflow "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__'
[[foo]]
script = true
__FLOW_CONFIG__
#-------------------------------------------------------------------------------

TEST_NAME="${TEST_NAME_BASE}-run"
workflow_run_ok "${TEST_NAME}" cylc play --debug --no-detach "${WORKFLOW_NAME}"
#-------------------------------------------------------------------------------

TEST_NAME=${TEST_NAME_BASE}-cli-poll
run_ok "${TEST_NAME}" cylc workflow-state "${WORKFLOW_NAME}" -p 20100101T0000Z \
--task=foo --status=succeeded
contains_ok "${TEST_NAME}.stdout" <<__OUT__
polling for 'succeeded': satisfied
__OUT__
#-------------------------------------------------------------------------------

TEST_NAME=${TEST_NAME_BASE}-cli-dump
run_ok "${TEST_NAME}" cylc workflow-state "${WORKFLOW_NAME}" -p 20100101T0000Z
contains_ok "${TEST_NAME}.stdout" <<__OUT__
foo, 2010-01-01, succeeded
foo, 2010-01-01, succeeded, [1]
__OUT__
#-------------------------------------------------------------------------------

purge
#-------------------------------------------------------------------------------
exit 0

20 changes: 9 additions & 11 deletions tests/functional/workflow-state/06a-noformat.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------

# Test "cylc workflow-state" cycle point format conversion, when the target workflow
# sets no explicit cycle point format, and the CLI does (the reverse of 06.t).

. "$(dirname "$0")/test_header"
#-------------------------------------------------------------------------------

set_test_number 5
#-------------------------------------------------------------------------------

init_workflow "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__'
[scheduler]
UTC mode = True
Expand All @@ -34,23 +33,22 @@ init_workflow "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__'
[[foo]]
script = true
__FLOW_CONFIG__
#-------------------------------------------------------------------------------

TEST_NAME="${TEST_NAME_BASE}-run"
workflow_run_ok "${TEST_NAME}" cylc play --debug --no-detach "${WORKFLOW_NAME}"
#-------------------------------------------------------------------------------

TEST_NAME=${TEST_NAME_BASE}-cli-poll
run_ok "${TEST_NAME}" cylc workflow-state "${WORKFLOW_NAME}" -p 2010-01-01T00:00Z \
--task=foo --status=succeeded
contains_ok "${TEST_NAME}.stdout" <<__OUT__
polling for 'succeeded': satisfied
__OUT__
#-------------------------------------------------------------------------------

TEST_NAME=${TEST_NAME_BASE}-cli-dump
run_ok "${TEST_NAME}" cylc workflow-state "${WORKFLOW_NAME}" -p 2010-01-01T00:00Z
contains_ok "${TEST_NAME}.stdout" <<__OUT__
foo, 20100101T0000Z, succeeded
foo, 20100101T0000Z, succeeded, [1]
__OUT__
#-------------------------------------------------------------------------------

purge
#-------------------------------------------------------------------------------
exit 0

10 changes: 5 additions & 5 deletions tests/functional/workflow-state/07-message2.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# Test workflow-state message query on a waiting task - GitHub #2440.

# Test workflow-state output query on a waiting task - GitHub #2440.
. "$(dirname "$0")/test_header"
set_test_number 4

install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"

run_ok "${TEST_NAME_BASE}-val" cylc validate "${WORKFLOW_NAME}"

workflow_run_ok "${TEST_NAME_BASE}-run" cylc play --debug --no-detach "${WORKFLOW_NAME}"
workflow_run_ok "${TEST_NAME_BASE}-run" \
cylc play --debug --no-detach "${WORKFLOW_NAME}"

TEST_NAME=${TEST_NAME_BASE}-query
run_fail "${TEST_NAME}" cylc workflow-state \
"${WORKFLOW_NAME}" -p 2013 -t foo --max-polls=1 -m "the quick brown fox"
run_fail "${TEST_NAME}" cylc workflow-state "${WORKFLOW_NAME}" \
-p 2013 -t foo --max-polls=1 --output x

grep_ok "ERROR: condition not satisfied" "${TEST_NAME}.stderr"

Expand Down
13 changes: 0 additions & 13 deletions tests/functional/workflow-state/template_ref/flow.cylc

This file was deleted.

4 changes: 0 additions & 4 deletions tests/functional/workflow-state/template_ref/reference.log

This file was deleted.

0 comments on commit 113942b

Please sign in to comment.