Skip to content

Commit

Permalink
Tests: Remove ability to create PRE config in create_test_global_config
Browse files Browse the repository at this point in the history
No longer needed as everything in globalcfg comes under sections now
  • Loading branch information
MetRonnie committed Nov 12, 2020
1 parent 19d114d commit 201c191
Show file tree
Hide file tree
Showing 50 changed files with 91 additions and 87 deletions.
2 changes: 1 addition & 1 deletion tests/flakyfunctional/hold-release/13-ready-restart.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export REQUIRE_PLATFORM='loc:local batch:at'
. "$(dirname "$0")/test_header"
set_test_number 3

create_test_global_config "" "
create_test_global_config "
[platforms]
[[wibble]]
hosts = localhost
Expand Down
2 changes: 1 addition & 1 deletion tests/flakyfunctional/job-submission/18-check-chunking.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set_test_number 3
create_test_global_config '
[scheduler]
process pool size = 1
' ''
'

init_suite "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__'
[scheduler]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ init_suite "${TEST_NAME_BASE}" <<< '
P1D = foo
'

create_test_global_config '' "
create_test_global_config "
${BASE_GLOBAL_CONFIG}
[suite servers]
run hosts = localhost
Expand All @@ -51,7 +51,7 @@ ${BASE_GLOBAL_CONFIG}
cylc run "${SUITE_NAME}" --debug
poll_suite_running

create_test_global_config '' "
create_test_global_config "
${BASE_GLOBAL_CONFIG}
[suite servers]
run hosts = localhost
Expand Down
4 changes: 2 additions & 2 deletions tests/flakyfunctional/restart/40-auto-restart-force-stop.t
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ init_suite "${TEST_NAME_BASE}" <<< '
R1 = foo
'

create_test_global_config '' "
create_test_global_config "
${BASE_GLOBAL_CONFIG}
[suite servers]
run hosts = localhost
Expand All @@ -47,7 +47,7 @@ ${BASE_GLOBAL_CONFIG}
cylc run "${SUITE_NAME}" --hold
poll_suite_running

create_test_global_config '' "
create_test_global_config "
${BASE_GLOBAL_CONFIG}
[suite servers]
run hosts = localhost
Expand Down
5 changes: 3 additions & 2 deletions tests/functional/cylc-cat-log/01-remote.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ export REQUIRE_PLATFORM='loc:remote'
. "$(dirname "$0")/test_header"
#-------------------------------------------------------------------------------
set_test_number 14
create_test_global_config "" "
create_test_global_config "
[platforms]
[[${CYLC_TEST_PLATFORM}]]
retrieve job logs = False"
retrieve job logs = False
"
install_suite "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
#-------------------------------------------------------------------------------
TEST_NAME="${TEST_NAME_BASE}-validate"
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/cylc-cat-log/04-local-tail.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#-------------------------------------------------------------------------------
set_test_number 3
install_suite "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
create_test_global_config "" "
create_test_global_config "
[platforms]
[[localhost]]
tail command template = $PWD/bin/my-tailer.sh %(filename)s
Expand Down
5 changes: 3 additions & 2 deletions tests/functional/cylc-cat-log/05-remote-tail.t
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ SSH='ssh -oBatchMode=yes -oConnectTimeout=5'
SCP='scp -oBatchMode=yes -oConnectTimeout=5'
$SSH -n "${CYLC_TEST_HOST}" "mkdir -p cylc-run/.bin"
# shellcheck disable=SC2016
create_test_global_config "" "
create_test_global_config "
[platforms]
[[$CYLC_TEST_PLATFORM]]
tail command template = \$HOME/cylc-run/.bin/my-tailer.sh %(filename)s"
tail command template = \$HOME/cylc-run/.bin/my-tailer.sh %(filename)s
"
#-------------------------------------------------------------------------------
TEST_NAME="${TEST_NAME_BASE}-validate"
run_ok "${TEST_NAME}" cylc validate "${SUITE_NAME}"
Expand Down
5 changes: 3 additions & 2 deletions tests/functional/cylc-cat-log/10-remote-no-retrieve.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ export REQUIRE_PLATFORM='loc:remote'
. "$(dirname "$0")/test_header"
set_test_number 5

create_test_global_config "" "
create_test_global_config "
[platforms]
[[${CYLC_TEST_PLATFORM}]]
retrieve job logs = False"
retrieve job logs = False
"
install_suite "${TEST_NAME_BASE}" remote-simple

TEST_NAME="${TEST_NAME_BASE}-validate"
Expand Down
5 changes: 3 additions & 2 deletions tests/functional/cylc-cat-log/11-remote-retrieve.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ export REQUIRE_PLATFORM='loc:remote'
. "$(dirname "$0")/test_header"
set_test_number 7

create_test_global_config "" "
create_test_global_config "
[platforms]
[[${CYLC_TEST_PLATFORM}]]
retrieve job logs = True"
retrieve job logs = True
"
install_suite "${TEST_NAME_BASE}" remote-simple

TEST_NAME="${TEST_NAME_BASE}-validate"
Expand Down
5 changes: 3 additions & 2 deletions tests/functional/cylc-cat-log/editor/bin/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
set_test_number 16

# Configure a fake editor that just copies a job file to ${DESTFILE}.
create_test_global_config '' '
create_test_global_config '
[editors]
terminal = my-editor
gui = my-editor'
gui = my-editor
'

function run_tests {
PLATFORM=$1
Expand Down
5 changes: 3 additions & 2 deletions tests/functional/cylc-edit/00-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ TEST_NAME="${TEST_NAME_BASE}-validate-before"
run_fail "${TEST_NAME}" cylc validate "${SUITE_NAME}"

TEST_NAME="${TEST_NAME_BASE}"
create_test_global_config '' '
create_test_global_config '
[editors]
terminal = my-edit'
terminal = my-edit
'
PATH=$PWD/bin:$PATH run_ok "${TEST_NAME}" cylc edit -i "${SUITE_NAME}"

TEST_NAME="${TEST_NAME_BASE}-validate-after"
Expand Down
7 changes: 4 additions & 3 deletions tests/functional/cylc-get-site-config/02-jinja2.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
. "$(dirname "$0")/test_header"
set_test_number 3

create_test_global_config '#!jinja2' '
create_test_global_config '
#!jinja2
{% set UTC_MODE = True %}
[scheduler]
UTC mode = {{UTC_MODE}}'

UTC mode = {{UTC_MODE}}
'
run_ok "${TEST_NAME_BASE}" cylc get-global-config --item='[scheduler]UTC mode'
cmp_ok "${TEST_NAME_BASE}.stdout" <<<'True'
cmp_ok "${TEST_NAME_BASE}.stderr" <'/dev/null'
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/cylc-get-site-config/03-host-bool-override.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
. "$(dirname "$0")/test_header"
set_test_number 3

create_test_global_config '' '
create_test_global_config '
[platforms]
[[localhost]]
use login shell = True
[[mytesthost]]
use login shell = False'

use login shell = False
'
run_ok "${TEST_NAME_BASE}" \
cylc get-global-config --item='[platforms][mytesthost]use login shell'
cmp_ok "${TEST_NAME_BASE}.stdout" <<<'False'
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/cylc-get-site-config/04-homeless.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
. "$(dirname "$0")/test_header"
set_test_number 3

create_test_global_config '' ''
create_test_global_config ''

run_ok "${TEST_NAME_BASE}" \
env -u HOME \
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/cylc-poll/02-task-submit-failed.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export REQUIRE_PLATFORM='batch:at comms:tcp'
. "$(dirname "$0")/test_header"
set_test_number 2

create_test_global_config "" "
create_test_global_config "
[platforms]
[[$CYLC_TEST_PLATFORM]]
batch submit command template = at noon tomorrow
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/cylc-poll/17-pbs-cant-connect.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export REQUIRE_PLATFORM="batch:pbs"

set_test_number 4

create_test_global_config "" "
create_test_global_config "
[platforms]
[[${CYLC_TEST_PLATFORM}]]
batch system = my_pbs
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/events/09-task-event-mail.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set_test_number 5
mock_smtpd_init
OPT_SET=
if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then
create_test_global_config "" "
create_test_global_config "
[scheduler]
[[mail]]
footer = see: http://localhost/stuff/%(owner)s/%(suite)s/
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/events/10-task-event-job-logs-retrieve.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export REQUIRE_PLATFORM='loc:remote'
. "$(dirname "$0")/test_header"
set_test_number 4
OPT_SET=
create_test_global_config "" "
create_test_global_config "
[platforms]
[[${CYLC_TEST_PLATFORM}]]
retrieve job logs = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export REQUIRE_PLATFORM='loc:remote'
. "$(dirname "$0")/test_header"
set_test_number 3

create_test_global_config "" "
create_test_global_config "
[platforms]
[[${CYLC_TEST_PLATFORM}]]
retrieve job logs = True
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/events/18-suite-event-mail.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set_test_number 3
mock_smtpd_init
OPT_SET=
if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then
create_test_global_config "" "
create_test_global_config "
[scheduler]
[[events]]
mail events = startup, shutdown
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/events/20-suite-event-handlers.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
set_test_number 4
OPT_SET=
if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then
create_test_global_config "" "
create_test_global_config "
[scheduler]
[[events]]
handlers = echo 'Your %(suite)s suite has a %(event)s event and URL %(suite_url)s and suite-priority as %(suite-priority)s and suite-UUID as %(suite_uuid)s.'
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/events/30-task-event-mail-2.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set_test_number 5
mock_smtpd_init
OPT_SET=
if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then
create_test_global_config "" "
create_test_global_config "
[scheduler]
[[mail]]
footer = see: http://localhost/stuff/%(owner)s/%(suite)s/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
set_test_number 4

if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then
create_test_global_config '' ''
create_test_global_config ''
fi
install_suite "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
run_fail "${TEST_NAME_BASE}-validate" cylc validate "${SUITE_NAME}"
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/events/47-long-output.t
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set_test_number 10
create_test_global_config "
[scheduler]
process pool timeout = PT10S
" ""
"

# Long STDOUT output

Expand Down
2 changes: 1 addition & 1 deletion tests/functional/job-submission/00-user.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
. "$(dirname "$0")/test_header"
set_test_number 2

create_test_global_config "" "
create_test_global_config "
[platforms]
[[testme]]
hosts = localhost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export REQUIRE_PLATFORM='batch:at loc:remote'
. "$(dirname "$0")/test_header"
set_test_number 2

create_test_global_config '' "
create_test_global_config "
[platforms]
[[${CYLC_TEST_PLATFORM}]]
batch system = at
Expand Down
1 change: 0 additions & 1 deletion tests/functional/job-submission/16-timeout.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ set_test_number 4
create_test_global_config "
[scheduler]
process pool timeout = PT10S
" "
[platforms]
[[$CYLC_TEST_PLATFORM]]
batch submit command template = sleep 30
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/jobscript/00-torture.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ install_suite "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
TEST_NAME="${TEST_NAME_BASE}-validate"
run_ok "${TEST_NAME}" cylc validate "${SUITE_NAME}"
export PATH_TO_CYLC_BIN="/path/to/cylc/bin"
create_test_global_config '' "
create_test_global_config "
[platforms]
[[localhost]]
cylc executable = $PATH_TO_CYLC_BIN/cylc"
Expand Down
14 changes: 4 additions & 10 deletions tests/functional/lib/bash/test_header
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,9 @@
# Install a reference suite using `install_suite`, run a validation
# test on the suite and run the reference suite with `suite_run_ok`.
# Expect 2 OK tests.
# create_test_global_config [PRE [POST]]
# create_test_global_config [POST]
# Create a new global config file $PWD/etc from global-tests.cylc
# with PRE and POST pre- and ap-pended (PRE for top level items with no
# section heading). PRE and POST are strings.
# with the string POST appended.
# localhost_fqdn
# Get the FQDN of the current host using the same mechanism Cylc uses.
# get_fqdn [TARGET]
Expand Down Expand Up @@ -686,22 +685,17 @@ reftest() {

create_test_global_config() {
# (Documented in file header).
local PRE=
local POST=
if (( $# == 1 )); then
PRE=$1
elif (( $# == 2 )); then
PRE=$1
POST=$2
elif (( $# > 2 )); then
POST=$1
elif (( $# > 1 )); then
echo 'ERROR, create_test_global_config: too many args' >&2
exit 1
fi
# Tidy in case of previous use of this function.
rm -fr 'etc'
mkdir 'etc'
# Suite host self-identification method.
echo "$PRE" >'etc/global.cylc'
USER_TESTS_CONF_FILE="${HOME}/.cylc/flow/$(cylc version)/global-tests.cylc"
if [[ -f "${USER_TESTS_CONF_FILE}" ]]; then
cat "${USER_TESTS_CONF_FILE}" >>'etc/global.cylc'
Expand Down
5 changes: 3 additions & 2 deletions tests/functional/logging/03-roll.t
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ init_suite "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__'
script = true
__FLOW_CONFIG__

create_test_global_config '' '
create_test_global_config '
[scheduler]
[[logging]]
rolling archive length = 8
maximum size in bytes = 2048'
maximum size in bytes = 2048
'
run_ok "${TEST_NAME_BASE}-validate" \
cylc validate "${SUITE_NAME}"
suite_run_ok "${TEST_NAME_BASE}-run" \
Expand Down
10 changes: 5 additions & 5 deletions tests/functional/platforms/01-platform-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ set_test_number 1

TEST_NAME="${TEST_NAME_BASE}-val"

create_test_global_config "" "
[platforms]
[[lewis]]
hosts = localhost
install target = localhost
create_test_global_config "
[platforms]
[[lewis]]
hosts = localhost
install target = localhost
"

cat >'flow.cylc' <<'__FLOW_CONFIG__'
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/platforms/02-host-to-platform-upgrade.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export REQUIRE_PLATFORM='loc:remote'
. "$(dirname "$0")/test_header"
set_test_number 3

create_test_global_config '' "
create_test_global_config "
[platforms]
[[${CYLC_TEST_PLATFORM}]]
retrieve job logs = True
Expand Down
Loading

0 comments on commit 201c191

Please sign in to comment.