Skip to content

Commit

Permalink
New cat-log tests added.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Apr 26, 2018
1 parent 59d617a commit 43c5d2c
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/cylc-cat-log/10-remote-no-retrieve.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2018 NIWA
#
# 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 cat-log" for remote tasks with no auto-retrieval.

CYLC_TEST_IS_GENERIC=false
. $(dirname $0)/test_header

set_test_remote
set_test_number 5

create_test_globalrc "" "
[hosts]
[[${CYLC_TEST_HOST}]]
retrieve job logs = False"
install_suite $TEST_NAME_BASE remote-simple

TEST_NAME=${TEST_NAME_BASE}-validate
run_ok $TEST_NAME cylc validate $SUITE_NAME

TEST_NAME=$TEST_NAME_BASE-run
suite_run_ok $TEST_NAME cylc run --debug --no-detach $SUITE_NAME

# Local job.out should not exist (not retrieved).
LOCAL_JOB_DIR=$(cylc cat-log -f a -m d $SUITE_NAME a-task.1)
exists_fail "${LOCAL_JOB_DIR}/job.out"

# Cat the remote one.
TEST_NAME=${TEST_NAME_BASE}-task-out
run_ok $TEST_NAME cylc cat-log -f o $SUITE_NAME a-task.1
grep_ok '^the quick brown fox$' ${TEST_NAME}.stdout
54 changes: 54 additions & 0 deletions tests/cylc-cat-log/11-remote-retrieve.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2018 NIWA
#
# 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 cat-log" for remote tasks with auto-retrieval.

CYLC_TEST_IS_GENERIC=false
. $(dirname $0)/test_header

set_test_remote
set_test_number 7

create_test_globalrc "" "
[hosts]
[[${CYLC_TEST_HOST}]]
retrieve job logs = True"
install_suite $TEST_NAME_BASE remote-simple

TEST_NAME=${TEST_NAME_BASE}-validate
run_ok $TEST_NAME cylc validate $SUITE_NAME

TEST_NAME=${TEST_NAME_BASE}-run
suite_run_ok $TEST_NAME cylc run --debug --no-detach $SUITE_NAME

# Local job.out should exist (retrieved).
LOCAL_JOB_OUT=$(cylc cat-log -f a -m d $SUITE_NAME a-task.1)/job.out
exists_ok "${LOCAL_JOB_OUT}"

# Distinguish local from remote job.out.
perl -pi -e 's/fox/FOX/' "${LOCAL_JOB_OUT}"

# Cat the remote one.
TEST_NAME=${TEST_NAME_BASE}-out-rem
run_ok $TEST_NAME cylc cat-log --force-remote -f o $SUITE_NAME a-task.1
grep_ok '^the quick brown fox$' ${TEST_NAME}.stdout

# Cat the local one.
TEST_NAME=${TEST_NAME_BASE}-out-loc
run_ok $TEST_NAME cylc cat-log -f o $SUITE_NAME a-task.1
grep_ok '^the quick brown FOX$' ${TEST_NAME}.stdout
14 changes: 14 additions & 0 deletions tests/cylc-cat-log/remote-simple/suite.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!Jinja2
[cylc]
[[events]]
abort on timeout = True
timeout = PT1M
[scheduling]
[[dependencies]]
graph = a-task
[runtime]
[[a-task]]
script = echo "the quick brown fox"
[[[remote]]]
host={{environ['CYLC_TEST_HOST'] | default("localhost")}}
owner={{environ['CYLC_TEST_OWNER'] | default(environ["USER"])}}

0 comments on commit 43c5d2c

Please sign in to comment.