Skip to content

Commit

Permalink
Add new functional test.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed May 3, 2023
1 parent 26aa665 commit e0780e1
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
59 changes: 59 additions & 0 deletions tests/functional/restart/59-retart-timeout.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/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/>.
#-------------------------------------------------------------------------------

# GitHub 5231: Test that a finished workflow waits on a timeout if restarted.

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

set_test_number 8

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

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

# Run to completion.
TEST_NAME="${TEST_NAME_BASE}-run"
workflow_run_ok "${TEST_NAME}" cylc play --no-detach "${WORKFLOW_NAME}"

# Restart completed workflow: it should stall on a restart timer.
TEST_NAME="${TEST_NAME_BASE}-restart"
run_ok "${TEST_NAME}" cylc play "${WORKFLOW_NAME}"

# Search log for restart timer.
TEST_NAME="${TEST_NAME_BASE}-grep1"
grep_workflow_log_ok "${TEST_NAME}" "restart timer starts NOW"

# Check that it has not shut down automatically.
TEST_NAME="${TEST_NAME_BASE}-grep2"
grep_fail "Workflow shutting down" "${WORKFLOW_RUN_DIR}/log/scheduler/log"

# Retriggering the task should stop the timer, and shut down as complete again.
TEST_NAME="${TEST_NAME_BASE}-trigger"
run_ok "${TEST_NAME}" cylc trigger "${WORKFLOW_NAME}//1/foo"

poll_grep_workflow_log "Workflow shutting down - AUTOMATIC"

TEST_NAME="${TEST_NAME_BASE}-grep3"
grep_workflow_log_ok "${TEST_NAME}" "restart timer stopped"

# It should not be running now.
TEST_NAME="${TEST_NAME_BASE}-ping"
run_fail "${TEST_NAME}" cylc ping "${WORKFLOW_NAME}"

purge
10 changes: 10 additions & 0 deletions tests/functional/restart/59-retart-timeout/flow.cylc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[scheduler]
[[events]]
inactivity timeout = PT20S
abort on inactivity timeout = True
[scheduling]
[[graph]]
R1 = "foo"
[runtime]
[[foo]]
script = "true"

0 comments on commit e0780e1

Please sign in to comment.