Skip to content

Commit

Permalink
Fix bug in func test
Browse files Browse the repository at this point in the history
  • Loading branch information
MetRonnie committed Jan 21, 2021
1 parent 0d018ac commit 838edcb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/functional/cylc-run/02-format.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,19 @@

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

set_test_number 7
set_test_number 8

init_suite "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__'
[scheduling]
[[dependencies]]
R1 = foo
[runtime]
[[foo]]
script = cylc stop --now --now "${CYLC_SUITE_NAME}"
__FLOW_CONFIG__

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

# format=plain
TEST_NAME="${TEST_NAME_BASE}-run-format=plain"
TEST_NAME="${TEST_NAME_BASE}-run-format-plain"
suite_run_ok "${TEST_NAME}" cylc play --format plain "${SUITE_NAME}"
grep_ok 'listening on tcp:' "${TEST_NAME}.stdout"
grep_ok 'publishing on tcp:' "${TEST_NAME}.stdout"
Expand All @@ -45,9 +42,16 @@ grep_ok 'Other ways to see if the suite is still running:' \
"${TEST_NAME}.stdout"
poll_suite_stopped

delete_db
purge

init_suite "${TEST_NAME_BASE}-json" <<'__FLOW_CONFIG__'
[scheduling]
[[dependencies]]
R1 = foo
__FLOW_CONFIG__

# format=json
TEST_NAME="${TEST_NAME_BASE}-run-format=plain"
TEST_NAME="${TEST_NAME_BASE}-run-format-json"
suite_run_ok "${TEST_NAME}" cylc play --format json "${SUITE_NAME}"
run_ok "${TEST_NAME}-fields" python3 -c '
import json
Expand All @@ -56,7 +60,7 @@ data = json.load(open(sys.argv[1], "r"))
print(list(sorted(data)), file=sys.stderr)
assert list(sorted(data)) == [
"host", "pid", "ps_opts", "pub_url", "suite", "url"]
' "${TEST_NAME}.stdout" >&2 2>&2
' "${TEST_NAME}.stdout"
poll_suite_stopped

purge
3 changes: 3 additions & 0 deletions tests/functional/lib/bash/test_header
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@
# SSH to TARGET and return `hostname -f`.
# dump_std TEST_NAME
# Dump stdout and stderr of TEST_NAME to the test log dir.
# delete_db [SUITE_RUN_DIR]
# Delete private/public workflow databases for a cold start.
#-------------------------------------------------------------------------------
set -eu

Expand Down Expand Up @@ -895,6 +897,7 @@ _check_test_requirements () {

delete_db() {
# Delete private/public workflow databases for a cold start
local SUITE_RUN_DIR="${1:-$SUITE_RUN_DIR}"
rm "${SUITE_RUN_DIR}/.service/db" "${SUITE_RUN_DIR}/log/db"
}

Expand Down

0 comments on commit 838edcb

Please sign in to comment.