Skip to content

Commit

Permalink
Add func test.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Sep 7, 2022
1 parent 8c6d2a1 commit 28a593b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/functional/reload/27-stall-retrigger.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/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 retriggering a failed task after fixing the bug and reloading.
# It should run correctly with the updated settings.

# https://github.com/cylc/cylc-flow/issues/5103

. "$(dirname "$0")/test_header"
set_test_number 2
reftest
13 changes: 13 additions & 0 deletions tests/functional/reload/27-stall-retrigger/bin/stall-handler.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Change "script = false" -> "true" in 1/foo, then reload and retrigger it.

if grep "\[command\] reload_workflow" "${CYLC_WORKFLOW_LOG_DIR}/log" >/dev/null; then
# Abort if not the first call (avoid an endless loop if the reload does not
# have the intended effect).
cylc stop --now --now "${CYLC_WORKFLOW_ID}"
exit 1
fi
sed -i "s/false/true/" "${CYLC_WORKFLOW_RUN_DIR}/flow.cylc"
cylc reload "${CYLC_WORKFLOW_ID}"
cylc trigger "${CYLC_WORKFLOW_ID}//1/foo"
13 changes: 13 additions & 0 deletions tests/functional/reload/27-stall-retrigger/flow.cylc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Use a stall handler to fix and reload the workflow config, then retrigger the
# failed task, which should run successfully with the new settings.
[scheduler]
[[events]]
stall handlers = stall-handler.sh
expected task failures = 1/foo
[scheduling]
[[graph]]
R1 = "foo => bar"
[runtime]
[[foo]]
script = false
[[bar]]
3 changes: 3 additions & 0 deletions tests/functional/reload/27-stall-retrigger/reference.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1/foo -triggered off [] in flow 1
1/foo -triggered off [] in flow 1
1/bar -triggered off ['1/foo'] in flow 1

0 comments on commit 28a593b

Please sign in to comment.