Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions e2e/core/test_python_venv_with_go_backend_deadlock_slow
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
# fixes https://github.com/jdx/mise/discussions/7059
set -euo pipefail
export MISE_PYTHON_GITHUB_ATTESTATIONS=0
install_timeout="${MISE_E2E_INSTALL_TIMEOUT:-180}"

cleanup_go_cache() {
# Required to properly cleanup as go installs read-only sources
if [ -d ~/go ]; then
chmod -R +w ~/go
fi
}
Comment on lines +10 to +15

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since set -euo pipefail is enabled, any failure in the chmod command (for example, if files are concurrently modified or if there are permission restrictions) will cause the cleanup function to exit with an error. In an EXIT trap, this can result in the entire script exiting with a non-zero status, causing false-positive test failures in CI.

Additionally, using "$HOME/go" is more robust and standard in shell scripts than the unquoted tilde ~/go.

Consider appending || true to the chmod command and using "$HOME/go".

cleanup_go_cache() {
  # Required to properly cleanup as go installs read-only sources
  if [ -d "$HOME/go" ]; then
    chmod -R +w "$HOME/go" || true
  fi
}

trap cleanup_go_cache EXIT

cat >.mise.toml <<EOF
[tools]
Expand All @@ -18,7 +27,7 @@ EOF

# This should complete without timeout (previously would hang indefinitely)
# The go backend tool resolution should not interfere with Python venv creation
timeout 60 mise install
timeout "$install_timeout" mise install

# Verify Python venv was created
assert "mise x -- python --version" "Python 3.12.3"
Expand All @@ -27,6 +36,3 @@ assert "mise x -- which python" "$HOME/my_venv/bin/python"

# Verify Go backend tool was installed and can run
assert_contains "mise x -- gum --version" "0.17.0"

# Required to properly cleanup as go installs read-only sources
chmod -R +w ~/go
Loading