From 041c78f296d069f78bb9ab5e74d412e5867e8ee1 Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Sat, 12 Jul 2025 11:35:47 -0500 Subject: [PATCH 1/4] fix(e2e): allow running tests by full, relative, or filename path --- e2e/run_test | 9 ++++++++- xtasks/test/e2e | 21 +++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/e2e/run_test b/e2e/run_test index 9409c9e281..1b8b14b030 100755 --- a/e2e/run_test +++ b/e2e/run_test @@ -7,7 +7,14 @@ ROOT="$(cd "$SCRIPT_DIR"/.. && pwd)" source "$SCRIPT_DIR/style.sh" TEST="$1" -TEST_SCRIPT="$SCRIPT_DIR/$TEST" +# Handle both relative and absolute paths +if [[ $TEST == /* ]] || [[ $TEST == e2e/* ]]; then + # If it's an absolute path or already contains e2e/, use it as is + TEST_SCRIPT="$TEST" +else + # Otherwise, treat it as relative to the e2e directory + TEST_SCRIPT="$SCRIPT_DIR/$TEST" +fi setup_isolated_env() { TEST_ISOLATED_DIR="$(mktemp --tmpdir --directory "$(basename "$TEST").XXXXXX")" diff --git a/xtasks/test/e2e b/xtasks/test/e2e index 23225c8624..450f0b89c5 100755 --- a/xtasks/test/e2e +++ b/xtasks/test/e2e @@ -1,6 +1,6 @@ #!/usr/bin/env bash #MISE depends=["build"] -#MISE alias="e" +#MISE alias=["e", "e2e"] #MISE description="run end-to-end tests" set -euo pipefail @@ -9,14 +9,27 @@ export RUST_TEST_THREADS=1 if [[ ${1:-all} == all ]]; then ./e2e/run_all_tests else - pushd e2e - FILES="$(fd -tf "$1" --and "^test_")" - popd + PATTERN="$1" + if [[ $PATTERN == e2e/* ]]; then + PATTERN="${PATTERN#e2e/}" + fi + # Debug output + echo "[xtask:e2e] Searching for test pattern: $PATTERN" >&2 + pushd e2e >/dev/null + if [[ -f $PATTERN ]]; then + FILES="$PATTERN" + elif [[ $PATTERN == */* ]]; then + FILES="$(fd -tf "$(basename "$PATTERN")")" + else + FILES="$(fd -tf "$PATTERN" --and "^test_")" + fi + popd >/dev/null if [[ -z $FILES ]]; then echo "Not test matches $1" >&2 exit 1 fi for FILE in $FILES; do + echo "[xtask:e2e] Running test: $FILE" >&2 ./e2e/run_test "$FILE" done fi From fbe0051e10f2a31b09c432f5307a34b93cabb98d Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Sat, 12 Jul 2025 11:38:25 -0500 Subject: [PATCH 2/4] fix(e2e): simplify test path handling logic --- xtasks/test/e2e | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/xtasks/test/e2e b/xtasks/test/e2e index 450f0b89c5..c1dfb16c81 100755 --- a/xtasks/test/e2e +++ b/xtasks/test/e2e @@ -9,25 +9,19 @@ export RUST_TEST_THREADS=1 if [[ ${1:-all} == all ]]; then ./e2e/run_all_tests else - PATTERN="$1" - if [[ $PATTERN == e2e/* ]]; then - PATTERN="${PATTERN#e2e/}" - fi - # Debug output - echo "[xtask:e2e] Searching for test pattern: $PATTERN" >&2 + # Strip e2e/ prefix if present, then extract just the filename + PATTERN="${1#e2e/}" + FILENAME="$(basename "$PATTERN")" + pushd e2e >/dev/null - if [[ -f $PATTERN ]]; then - FILES="$PATTERN" - elif [[ $PATTERN == */* ]]; then - FILES="$(fd -tf "$(basename "$PATTERN")")" - else - FILES="$(fd -tf "$PATTERN" --and "^test_")" - fi + FILES="$(fd -tf "$FILENAME" --and "^test_")" popd >/dev/null + if [[ -z $FILES ]]; then - echo "Not test matches $1" >&2 + echo "No test matches $1" >&2 exit 1 fi + for FILE in $FILES; do echo "[xtask:e2e] Running test: $FILE" >&2 ./e2e/run_test "$FILE" From 9f1fc36fbcd0d485b4f1eb96b166ab010ccc399e Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sat, 12 Jul 2025 16:45:02 +0000 Subject: [PATCH 3/4] [autofix.ci] apply automated fixes --- tasks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks.md b/tasks.md index 90c739e1b6..34a61c4442 100644 --- a/tasks.md +++ b/tasks.md @@ -226,7 +226,7 @@ run all tests with coverage report - Depends: build - **Usage**: `test:e2e` -- **Aliases**: `e` +- **Aliases**: `e`, `e2e` run end-to-end tests From cb630eb3a14ae11db0c2f2def7491ce368e71ce3 Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Sat, 12 Jul 2025 12:16:42 -0500 Subject: [PATCH 4/4] fix: resolve e2e test paths to absolute paths to prevent file not found errors The previous path handling logic set TEST_SCRIPT to a relative path when TEST started with e2e/. This relative path became invalid because TEST_SCRIPT is sourced after the working directory changes to the isolated test environment (TEST_WORKDIR). As TEST_WORKDIR does not contain an e2e/ subdirectory, this resulted in 'file not found' errors. This change introduces proper path resolution: - Absolute paths (starting with /) are used as-is - Paths starting with e2e/ are resolved relative to the project root () - Other relative paths are resolved relative to the e2e directory () This eliminates the dependency on the current working directory and maintains location independence. --- e2e/run_test | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/e2e/run_test b/e2e/run_test index 1b8b14b030..244ce6ed85 100755 --- a/e2e/run_test +++ b/e2e/run_test @@ -8,9 +8,12 @@ source "$SCRIPT_DIR/style.sh" TEST="$1" # Handle both relative and absolute paths -if [[ $TEST == /* ]] || [[ $TEST == e2e/* ]]; then - # If it's an absolute path or already contains e2e/, use it as is +if [[ $TEST == /* ]]; then + # If it's an absolute path, use it as is TEST_SCRIPT="$TEST" +elif [[ $TEST == e2e/* ]]; then + # If it starts with e2e/, treat it as relative to the project root + TEST_SCRIPT="$ROOT/$TEST" else # Otherwise, treat it as relative to the e2e directory TEST_SCRIPT="$SCRIPT_DIR/$TEST"