Skip to content

Commit

Permalink
Restored cylc-remove tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Apr 30, 2020
1 parent fb08af4 commit 15fe8e4
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/cylc-remove/00-simple.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# THIS FILE IS PART OF THE CYLC SUITE 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 remove
. "$(dirname "$0")/test_header"
set_test_number 2
reftest
exit
5 changes: 5 additions & 0 deletions tests/cylc-remove/00-simple/reference.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
2013/10/02 11:54:04 INFO - Initial point: 1
2013/10/02 11:54:04 INFO - Final point: 1
2013/10/02 11:54:04 INFO - [a.1] -triggered off []
2013/10/02 11:54:11 INFO - [cleaner.1] -triggered off []
2013/10/02 11:54:07 INFO - [b.1] -triggered off ['a.1']
25 changes: 25 additions & 0 deletions tests/cylc-remove/00-simple/suite.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Abort on timeout unless we remove unhandled failed and waiting task.
[cylc]
[[reference test]]
expected task failures = b.1
[[events]]
timeout = PT20S
abort on timeout = True
[scheduling]
[[graph]]
R1 = """a => b => c
cleaner"""
[runtime]
[[a,c]]
script = true
[[b]]
script = false
[[cleaner]]
script = """
cylc__job__poll_grep_suite_log 'b\.1.* failed'
# Remove the unhandled failed task.
cylc remove "$CYLC_SUITE_NAME" 'b.1'
# Remove waiting c.1
# (not auto-removed because parent b.1, an unhandled fail, is not finished.)
cylc remove "$CYLC_SUITE_NAME" '1/c:waiting'
"""
22 changes: 22 additions & 0 deletions tests/cylc-remove/02-cycling.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# THIS FILE IS PART OF THE CYLC SUITE 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 remove in a cycling suite (spawn before remove, and not).
. "$(dirname "$0")/test_header"
set_test_number 2
reftest
exit
11 changes: 11 additions & 0 deletions tests/cylc-remove/02-cycling/reference.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
2016-07-07T22:17:12Z INFO - Run mode: live
2016-07-07T22:17:12Z INFO - Initial point: 2020
2016-07-07T22:17:12Z INFO - Final point: 2021
2016-07-07T22:17:12Z INFO - Cold Start 2020
2016-07-07T22:17:12Z INFO - [remover.2020] -triggered off []
2016-07-07T22:17:12Z INFO - [foo.2020] -triggered off []
2016-07-07T22:17:14Z INFO - [foo.2021] -triggered off []
2016-07-07T22:17:29Z INFO - [bar.2020] -triggered off ['foo.2020']
2016-07-07T22:17:29Z INFO - [bar.2021] -triggered off ['foo.2021']
2016-07-07T22:17:29Z INFO - [baz.2020] -triggered off ['foo.2020']
2016-07-07T22:17:29Z INFO - [baz.2021] -triggered off ['foo.2021']
42 changes: 42 additions & 0 deletions tests/cylc-remove/02-cycling/suite.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Abort on timeout unless we successfully remove some failed and waiting tasks.
[cylc]
UTC mode = True
cycle point format = %Y
[[reference test]]
expected task failures = bar.2020, baz.2021
[[events]]
timeout = PT30S
abort on timeout = True
[scheduling]
initial cycle point = 2020
final cycle point = 2021
[[graph]]
R1 = remover
P1Y = foo => bar & baz => waz
[runtime]
[[remover]]
script = """
cylc__job__poll_grep_suite_log 'bar.2020.* failed'
cylc__job__poll_grep_suite_log 'baz.2021.* failed'
# Remove the two unhandled failed tasks.
cylc remove $CYLC_SUITE_NAME */ba*:failed
# Remove the two unsatisfied waiting tasks.
cylc remove $CYLC_SUITE_NAME */waz
# Exit so suite can shut down.
"""
[[foo, waz]]
script = true
[[bar]]
script = """
if [[ $CYLC_TASK_CYCLE_POINT == 2020 ]]; then
false
else
true
fi"""
[[baz]]
script = """
if [[ $CYLC_TASK_CYCLE_POINT == 2021 ]]; then
false
else
true
fi"""
1 change: 1 addition & 0 deletions tests/cylc-remove/test_header

0 comments on commit 15fe8e4

Please sign in to comment.