Skip to content

Commit 8715bcc

Browse files
tests/f: fix test IDs
* Test IDs should be prefixed with "$TEST_NAME_BASE". * Test IDs should be valid for use as file names (no ":", "/", " ", etc). * `named_grep_ok` was broken by default :(
1 parent 936fd49 commit 8715bcc

File tree

12 files changed

+49
-40
lines changed

12 files changed

+49
-40
lines changed

tests/functional/cylc-combination-scripts/10-CYLC_WORKFLOW_SRC_DIR.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ __HERE__
3636

3737
run_ok "${TEST_NAME_BASE}-view" cylc view -p .
3838

39-
named_grep_ok "src-path-in-view-p" "TEST: $PWD" \
39+
named_grep_ok "${TEST_NAME_BASE}-src-path-in-view-p" "TEST: $PWD" \
4040
"${TEST_NAME_BASE}-view.stdout"
4141

4242
# It starts playing:
@@ -47,7 +47,7 @@ run_ok "${TEST_NAME_BASE}-vip" \
4747
--workflow-name "${WORKFLOW_NAME}"
4848

4949
# It can get CYLC_WORKFLOW_SRC_DIR
50-
named_grep_ok "src-path-available" \
50+
named_grep_ok "${TEST_NAME_BASE}-src-path-available" \
5151
"TEST: $PWD" "${RUN_DIR}/${WORKFLOW_NAME}/log/config/flow-processed.cylc"
5252

5353
# It can be updated with Cylc VR
@@ -57,7 +57,7 @@ run_ok "${TEST_NAME_BASE}-vr" \
5757
poll_grep "meta" "${RUN_DIR}/${WORKFLOW_NAME}/log/config/flow-processed.cylc"
5858

5959
# It can get CYLC_WORKFLOW_SRC_DIR
60-
named_grep_ok "src-path-available" \
60+
named_grep_ok "${TEST_NAME_BASE}-src-path-available" \
6161
"TEST: $PWD" "${RUN_DIR}/${WORKFLOW_NAME}/log/config/flow-processed.cylc"
6262

6363
cylc stop "${WORKFLOW_NAME}"

tests/functional/cylc-lint/00.lint.t

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ rm etc/global.cylc
3030

3131
TEST_NAME="${TEST_NAME_BASE}.vanilla"
3232
run_fail "${TEST_NAME}" cylc lint .
33-
named_grep_ok "check-for-error-code" "S004" "${TEST_NAME}.stdout"
33+
named_grep_ok "${TEST_NAME_BASE}-check-for-error-code" "S004" "${TEST_NAME}.stdout"
3434

3535
TEST_NAME="${TEST_NAME_BASE}.pick-a-ruleset"
3636
run_fail "${TEST_NAME}" cylc lint . -r 728
37-
named_grep_ok "check-for-error-code" "U998" "${TEST_NAME}.stdout"
37+
named_grep_ok "${TEST_NAME_BASE}-check-for-error-code" "U998" "${TEST_NAME}.stdout"
3838

3939
TEST_NAME="${TEST_NAME_BASE}.inplace"
4040
run_fail "${TEST_NAME}" cylc lint . -i
41-
named_grep_ok "check-for-error-code-in-file" "U998" flow.cylc
41+
named_grep_ok "${TEST_NAME_BASE}-check-for-error-code-in-file" "U998" flow.cylc
4242

4343
rm flow.cylc
4444

@@ -49,7 +49,7 @@ __HERE__
4949

5050
TEST_NAME="${TEST_NAME_BASE}.pick-a-ruleset-728"
5151
run_fail "${TEST_NAME}" cylc lint . -r 728
52-
named_grep_ok "do-not-upgrade-check-if-compat-mode" "Lint after renaming" "${TEST_NAME}.stderr"
52+
named_grep_ok "${TEST_NAME_BASE}-do-not-upgrade-check-if-compat-mode" "Lint after renaming" "${TEST_NAME}.stderr"
5353

5454
TEST_NAME="${TEST_NAME_BASE}.pick-a-ruleset-728-exit-zero"
5555
run_ok "${TEST_NAME}" cylc lint . -r 728 --exit-zero
@@ -69,15 +69,15 @@ __HERE__
6969

7070
TEST_NAME="${TEST_NAME_BASE}.zero-issues"
7171
run_ok "${TEST_NAME}" cylc lint .
72-
named_grep_ok "message on no errors" "found no issues" "${TEST_NAME}.stdout"
72+
named_grep_ok "${TEST_NAME_BASE}-message-on-no-errors" "found no issues" "${TEST_NAME}.stdout"
7373

7474
# It returns an error message if you attempt to lint a non-existant location
7575
TEST_NAME="it-fails-if-not-target"
76-
run_fail ${TEST_NAME} cylc lint "a-$(uuidgen)"
76+
run_fail "${TEST_NAME}" cylc lint "a-$(uuidgen)"
7777
grep_ok "Workflow ID not found" "${TEST_NAME}.stderr"
7878

7979
# It returns a reference in reference mode
80-
TEST_NAME="it-returns-a-reference"
80+
TEST_NAME="${TEST_NAME_BASE}-it-returns-a-reference"
8181
run_ok "${TEST_NAME}" cylc lint --list-codes
8282
named_grep_ok "${TEST_NAME}-contains-style-codes" "^S001:" "${TEST_NAME}.stdout"
8383
TEST_NAME="it-returns-a-reference-style"

tests/functional/cylc-lint/01.lint-toml.t

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ __HERE__
4848

4949

5050
# Control tests
51-
TEST_NAME="it lints without toml file"
51+
TEST_NAME='it-lints-without-toml-file'
5252
run_fail "${TEST_NAME}" cylc lint
5353
TESTOUT="${TEST_NAME}.stdout"
54-
named_grep_ok "it returns error code" "S004" "${TESTOUT}"
55-
named_grep_ok "it returns error from subdirectory" "niwa.cylc" "${TESTOUT}"
56-
named_grep_ok "it returns a 728 upgrade code" "^\[U" "${TESTOUT}"
54+
named_grep_ok "${TEST_NAME_BASE}-returns-error-code" "S004" "${TESTOUT}"
55+
named_grep_ok "${TEST_NAME_BASE}-returns-error-from-subdirectory" "niwa.cylc" "${TESTOUT}"
56+
named_grep_ok "${TEST_NAME_BASE}-returns-728-upgrade-code" "^\[U" "${TESTOUT}"
5757

5858

5959
# Add a pyproject.toml file
@@ -75,7 +75,7 @@ exclude = [
7575
__HERE__
7676

7777
# Test that results are different:
78-
TEST_NAME="it_lints_with_toml_file"
78+
TEST_NAME='it-lints-with-toml-file'
7979
run_fail "${TEST_NAME}" cylc lint
8080
TESTOUT="${TEST_NAME}.stdout"
8181
grep_fail "S004" "${TESTOUT}"
@@ -93,13 +93,13 @@ cat > flow.cylc <<__HERE__
9393
"""
9494
__HERE__
9595

96-
TEST_NAME="it_fails_if_max-line-length_set"
96+
TEST_NAME="${TEST_NAME_BASE}-it-fails-if-max-line-length-set"
9797
run_fail "${TEST_NAME}" cylc lint
9898
named_grep_ok "${TEST_NAME}-line-too-long-message" \
9999
"\[${LINE_LEN_NO}\] flow.cylc:2: line > 4 characters." \
100100
"${TEST_NAME}.stdout"
101101

102-
TEST_NAME="it_does_not_fail_if_max-line-length_set_but_ignored"
102+
TEST_NAME='it-does-not-fail-if-max-line-length-set-but-ignored'
103103
cat > pyproject.toml <<__HERE__
104104
[tool.cylc.lint]
105105
# Check against these rules

tests/functional/intelligent-host-selection/00-mixedhost.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ workflow_run_ok "${TEST_NAME_BASE}-run" \
5656
# Run a bunch of tests on the workflow logs to ensure that warning messages
5757
# produced by Intelligent Host Selection Logic have happened.
5858

59-
named_grep_ok "unreachable host warning" \
59+
named_grep_ok "${TEST_NAME_BASE}-unreachable-host-warning" \
6060
'unreachable_host has been added to the list of unreachable hosts' \
6161
"${WORKFLOW_RUN_DIR}/log/scheduler/log"
6262

tests/functional/intelligent-host-selection/02-badhosts.t

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,16 @@ workflow_run_ok "${TEST_NAME_BASE}-run" \
6767
LOGFILE="${WORKFLOW_RUN_DIR}/log/scheduler/log"
6868

6969
# Check that badhosttask has submit failed, but not good or mixed
70-
named_grep_ok "badhost task submit failed" \
70+
named_grep_ok "${TEST_NAME_BASE}-badhost-task-submit-failed" \
7171
"1/badhosttask.* submit-failed" "${LOGFILE}"
72-
named_grep_ok "goodhost suceeded" \
72+
named_grep_ok "${TEST_NAME_BASE}-goodhost-suceeded" \
7373
"1/mixedhosttask.* succeeded" "${LOGFILE}"
74-
named_grep_ok "mixedhost task suceeded" \
74+
named_grep_ok "${TEST_NAME_BASE}-mixedhost-task-suceeded" \
7575
"1/goodhosttask.* succeeded" "${LOGFILE}"
7676

7777
# Check that when a task fail badhosts associated with that task's platform
7878
# are removed from the badhosts set.
79-
named_grep_ok "remove task platform bad hosts after submit-fail" \
79+
named_grep_ok "${TEST_NAME_BASE}-remove-task-platform-bad-hosts-after-submit-fail" \
8080
"initialisation did not complete (no hosts were reachable)" \
8181
"${LOGFILE}"
8282

tests/functional/intelligent-host-selection/03-polling.t

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@ LOGFILE="${WORKFLOW_RUN_DIR}/log/scheduler/log"
7575
# Check that when a task fail badhosts associated with that task's platform
7676
# are removed from the badhosts set.
7777
named_grep_ok \
78-
"job poll fails" \
78+
"${TEST_NAME_BASE}-job-poll-fails" \
7979
"unreachable_host has been added to the list of unreachable hosts" \
8080
"${LOGFILE}"
8181

82-
named_grep_ok "job poll retries & succeeds" \
82+
named_grep_ok \
83+
"${TEST_NAME_BASE}-job-poll-retries-and-succeeds" \
8384
"\[jobs-poll out\] \[TASK JOB SUMMARY\].*1/mixedhosttask/01" \
8485
"${LOGFILE}"
8586

tests/functional/intelligent-host-selection/06-from-platform-group-fails.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ logfile="${WORKFLOW_RUN_DIR}/log/scheduler/log"
5353

5454
# Check workflow fails for the reason we want it to fail
5555
named_grep_ok \
56-
"Workflow stalled with 1/bad (submit-failed)" \
56+
"${TEST_NAME_BASE}-workflow-stalled-with-bad-submit-failed" \
5757
"1/bad did not complete the required outputs" \
5858
"$logfile"
5959

@@ -80,7 +80,7 @@ done
8080

8181
# Look for message indicating that remote init has failed.
8282
named_grep_ok \
83-
"platform: badhostplatform. - initialisation did not complete (no hosts were reachable)" \
83+
"${TEST_NAME_BASE}-initialisation-did-not-complete" \
8484
"platform: badhostplatform. - initialisation did not complete (no hosts were reachable)" \
8585
"${logfile}"
8686

tests/functional/job-kill/00-local.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ TEST_NAME="${TEST_NAME_BASE}-run"
2929
workflow_run_ok "${TEST_NAME}" \
3030
cylc play --reference-test --debug --no-detach "${WORKFLOW_NAME}"
3131
#-------------------------------------------------------------------------------
32-
TEST_NAME=${TEST_NAME_BASE}-ps
32+
TEST_NAME="${TEST_NAME_BASE}-ps"
3333
for DIR in "${WORKFLOW_RUN_DIR}"/work/*/t*; do
3434
run_fail "${TEST_NAME}.$(basename "$DIR")" ps "$(cat "${DIR}/file")"
3535
done

tests/functional/lib/bash/test_header

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,13 +457,11 @@ __ERR__
457457

458458
named_grep_ok() {
459459
# (Put extra grep options like '-E' at end of the command line)
460-
local NAME="$1"
460+
local TEST_NAME="$1"
461461
local BRE="$2"
462462
local FILE="$3"
463463
shift 3
464464
local OPTS="$*"
465-
local TEST_NAME
466-
TEST_NAME="$(basename "${FILE}")-grep-ok"
467465
# shellcheck disable=SC2086
468466
if grep ${OPTS} -q -e "${BRE}" "${FILE}"; then
469467
ok "${TEST_NAME}"

tests/functional/platforms/12-ping-pong.t

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
3030
workflow_run_ok "${TEST_NAME_BASE}-run" \
3131
cylc play "${WORKFLOW_NAME}" --debug --no-detach
3232

33-
named_grep_ok "1/remote_task submits to ${CYLC_TEST_PLATFORM}" \
33+
named_grep_ok \
34+
"${TEST_NAME_BASE}-remote_task-submits-to-${CYLC_TEST_PLATFORM}" \
3435
"\[1/remote_task/01:preparing\] submitted to ${CYLC_TEST_PLATFORM}" \
3536
"${WORKFLOW_RUN_DIR}/log/scheduler/log"
3637

37-
named_grep_ok "2/remote_task submits to localhost" \
38+
named_grep_ok \
39+
"${TEST_NAME_BASE}-remote_task-submits-to-localhost" \
3840
"\[2/remote_task/01:preparing\] submitted to localhost" \
3941
"${WORKFLOW_RUN_DIR}/log/scheduler/log"
4042

0 commit comments

Comments
 (0)