Skip to content

Commit 80d108f

Browse files
fix: use isolated PATH in gh-availability-check tests for CI compatibility (merge worktree-20260326-074511)
2 parents c88df9c + c198bfd commit 80d108f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/scripts/test-gh-availability-check.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ echo "=== test-gh-availability-check.sh ==="
2323
_TMP=$(mktemp -d)
2424
trap 'rm -rf "$_TMP"' EXIT
2525

26+
# Create a PATH directory containing bash but NOT gh, for not-installed tests.
27+
# Using /usr/bin:/bin doesn't work in CI where gh is at /usr/bin/gh.
28+
_NO_GH_PATH="$_TMP/no-gh-path"
29+
mkdir -p "$_NO_GH_PATH"
30+
ln -s "$(command -v bash)" "$_NO_GH_PATH/bash"
31+
2632
# =============================================================================
2733
# test_gh_authenticated: Mock gh in PATH, mock gh auth status exit 0
2834
# assert output GH_STATUS=authenticated
@@ -82,7 +88,7 @@ echo ""
8288
echo "--- test_gh_not_installed ---"
8389
_snapshot_fail
8490

85-
not_installed_output=$(PATH="/usr/bin:/bin" bash "$GH_AVAIL" 2>&1)
91+
not_installed_output=$(PATH="$_NO_GH_PATH" bash "$GH_AVAIL" 2>&1)
8692
assert_contains "test_gh_not_installed: GH_STATUS=not_installed in output" "GH_STATUS=not_installed" "$not_installed_output"
8793
assert_contains "test_gh_not_installed: FALLBACK=ui_steps in output" "FALLBACK=ui_steps" "$not_installed_output"
8894

@@ -110,7 +116,7 @@ echo ""
110116
echo "--- test_fallback_ui_steps_format ---"
111117
_snapshot_fail
112118

113-
ui_steps_output=$(PATH="/usr/bin:/bin" bash "$GH_AVAIL" 2>&1)
119+
ui_steps_output=$(PATH="$_NO_GH_PATH" bash "$GH_AVAIL" 2>&1)
114120
assert_contains "test_fallback_ui_steps_format: github.com reference in output" "github.com" "$ui_steps_output"
115121

116122
assert_pass_if_clean "test_fallback_ui_steps_format"

0 commit comments

Comments
 (0)