Skip to content

fix: clean up plugins after failed plugin tests - #2313

Open
CAOShurong wants to merge 1 commit into
asdf-vm:masterfrom
CAOShurong:codex/fix-plugin-test-cleanup
Open

fix: clean up plugins after failed plugin tests#2313
CAOShurong wants to merge 1 commit into
asdf-vm:masterfrom
CAOShurong:codex/fix-plugin-test-cleanup

Conversation

@CAOShurong

@CAOShurong CAOShurong commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Return plugin-test validation failures through the CLI action instead of exiting immediately. This lets the existing deferred plugins.Remove call run after both successful and failed tests.

Add a Bats regression that removes a required callback, runs the failing plugin test twice, and verifies after each run that:

  • the expected validation error is preserved;
  • the second run does not fail with already added;
  • asdf-test-dummy is removed from the isolated data directory.

Fixes: #2130

Other Information

Root cause: failTest called cli.OsExiter(1) inside pluginTestCommand. Process exit bypassed the deferred cleanup registered after the temporary plugin was added.

Validation run locally on Linux under WSL with Go 1.26.5 and the repository-declared Bats 1.8.2:

  • go test ./cmd/asdf -run TestBatsTests/plugin_test_command -count=1
  • go test -timeout=30m -coverprofile=<E:-scratch-output> -bench= -race ./...
  • scripts/lint.bash --check with shfmt 3.6.0, ShellCheck 0.10.0, and the custom Python style checker
  • go run mvdan.cc/gofumpt -l .
  • go mod verify
  • go vet ./...
  • go run github.com/mgechev/revive -set_exit_status ./...
  • go run honnef.co/go/tools/cmd/staticcheck -tests -show-ignored ./...
  • go build -v ./...
  • real CLI success and failure paths using local fixture repositories and isolated ASDF_DATA_DIR values, including two consecutive failed runs

Local fish_indent was not available, so the Fish formatting portion of scripts/lint.bash --check was skipped with the script's normal warning. No Fish files changed. The macOS test matrix was not run locally.

The fork-triggered Lint and Test workflow runs are currently action_required with zero jobs started and need maintainer approval before they can execute. semantic-pr passed. This is an external workflow gate, not a CI pass or test failure; the unrun Fish and macOS checks remain unverified until those workflows run.

This contribution was prepared with OpenAI Codex assistance under CAOShurong's direction; the diff and the checks run are reported here without claiming unrun validation.

@CAOShurong
CAOShurong marked this pull request as ready for review August 12, 2026 13:22
@CAOShurong
CAOShurong requested a review from a team as a code owner August 12, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: asdf plugin test does not cleanup the test plugin

1 participant