-
-
Notifications
You must be signed in to change notification settings - Fork 948
test(test-tool): uninstall all versions and clear cache before installation #6393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
333a057
test(test-tool): uninstall all versions and clear cache before instal…
jdx c657381
test(test-tool): also clear downloads and reset config after uninstal…
jdx 986e1db
test(test-tool): simplify cleanup by hard deleting directories
jdx 0930a38
fix(test-tool): update e2e test to work with cleaning behavior
jdx b186cab
refactor(test-tool): simplify e2e test using shellcheck
jdx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euxo pipefail | ||
|
|
||
| # Test 1: Verify test-tool cleans existing installations before running | ||
| echo "=== Test 1: Clean existing installations ===" | ||
|
|
||
| # Install multiple versions first | ||
| mise install shellcheck@0.9.0 | ||
| mise install shellcheck@0.10.0 | ||
|
|
||
| # Verify both versions are installed | ||
| mise ls shellcheck | grep "0.9.0" | ||
| mise ls shellcheck | grep "0.10.0" | ||
| [ -d "$MISE_DATA_DIR/installs/shellcheck/0.9.0" ] | ||
| [ -d "$MISE_DATA_DIR/installs/shellcheck/0.10.0" ] | ||
|
|
||
| # Create a marker file to verify directories are cleaned | ||
| touch "$MISE_DATA_DIR/installs/shellcheck/marker.txt" | ||
| touch "$MISE_CACHE_DIR/shellcheck/marker.txt" 2>/dev/null || true | ||
|
|
||
| # Run test-tool which should clean everything first and succeed | ||
| mise test-tool shellcheck | ||
|
|
||
| # Verify the marker files are gone (directories were cleaned) | ||
| if [ -f "$MISE_DATA_DIR/installs/shellcheck/marker.txt" ]; then | ||
| echo "ERROR: installs directory was not cleaned" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Verify test-tool installed the latest version | ||
| mise ls shellcheck | grep -E "0\.[0-9]+\.[0-9]+" | ||
| [ -d "$MISE_DATA_DIR/installs/shellcheck" ] | ||
|
|
||
| # Test 2: Verify cache directory is cleaned | ||
| echo "=== Test 2: Cache directory cleaning ===" | ||
|
|
||
| # Create cache content | ||
| mkdir -p "$MISE_CACHE_DIR/shellcheck" | ||
| echo "cached data" >"$MISE_CACHE_DIR/shellcheck/test.cache" | ||
|
|
||
| # Run test-tool again | ||
| mise test-tool shellcheck | ||
|
|
||
| # Verify cache was cleaned and recreated | ||
| [ -d "$MISE_CACHE_DIR/shellcheck" ] | ||
| if [ -f "$MISE_CACHE_DIR/shellcheck/test.cache" ]; then | ||
| echo "ERROR: cache directory was not cleaned" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Test passed: test-tool correctly cleans all directories before installing" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Cleanup Fails, Report Incomplete
The cleanup logic only removes directories for the main tool, not its dependencies, which can lead to inconsistent test states. Also, if any directory removal fails, the progress report's
finish()method is skipped, leaving the report unfinished and potentially causing UI issues.