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
fix: don't override existing ASDF_DIR #1008
Merged
jthegedus
merged 1 commit into
asdf-vm:master
from
ericbn:dont_override_existing_ASDF_DIR
Nov 2, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
Do the tests fail without this change? Which new codepath requires this as I don't see any test changes.
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.
Yes, tests fail without this change because
setup_asdf_dir
creates an "empty" ASDF_DIR. It's more like a valid ASDF_DATA_DIR than a valid ASDF_DIR, because the {bin,lib} files are not there. Since with this change the asdf.sh will respect any previously set ASDF_DIR variable, that ASDF_DIR will be used, and the tests fail.Maybe we should move this
cp -rf $BATS_TEST_DIRNAME/../{bin,lib} $ASDF_DIR/
(which is repeated may times after callingsetup_asdf_dir
in individual tests) tosetup_asdf_dir
, so this function guarantees that a complete ASDF_DIR was created. WDYT?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.
I think I understand after looking through some code.
setup_asdf_dir
makes sense, but I question why it would be needed even after your change. As I understand, it will not overwriteASDF_DIR
if it is already set.ASDF_DIR
is set during thesetup_asdf_dir
func, so why would theseversion_commands.bats
tests start to fail?I would expect your change in
asdf.sh
to only affect tests inasdf_sh.bats
, but I don't think there's a test case for this scenarion, so a test should be added there.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.
The
version_commands.bats
tests fail because:setup_asdf_dir
in the setup step.setup_asdf_dir
creates a temp directory with no bin or lib filesASDF_DIR
env variable to be the path to that directory.. $(dirname "$BATS_TEST_DIRNAME")/asdf.sh
.asdf.sh
will use the value of the existingASDF_DIR
env variable, that was set bysetup_asdf_dir
lib/asdf.sh
file in thatASDF_DIR
.This is what I've mentioned in my previous comments, and that's why I've said that "setup_asdf_dir creates an 'empty' ASDF_DIR", and suggested that it should guarantee that the
ASDF_DIR
it creates is complete.