Skip to content
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

test: unset ASDF_DATA_DIR and ASDF_CONFIG_FILE during test #1722

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bootleq
Copy link

@bootleq bootleq commented Feb 19, 2024

Summary

The purpose of this small change is very similar to 6d8d77f which unset ASDF_DIR.

In user's login shell with asdf, ASDF_DATA_DIR and ASDF_CONFIG_FILE will be set / exported when calling shimmed commands, in test workflow the command is bats.

For quick reproduce, login with ASDF_DIR set to ~/.asdf and having shimmed bats command, then run tests:

  • bats test/uninstall_command.bats --filter 'uninstall command executes configured pre hook'
  • bats test/list_command.bats --filter 'list_command with plugin should list installed versions'

will fail due to aforementioned problem.

@bootleq bootleq requested a review from a team as a code owner February 19, 2024 13:34
@bootleq bootleq changed the title Unset ASDF_DATA_DIR and ASDF_CONFIG_FILE during test test: unset ASDF_DATA_DIR and ASDF_CONFIG_FILE during test Feb 19, 2024
@chrisjpalmer
Copy link

+1 I was just running unit tests... had this exact problem. Great PR

Like ASDF_DIR, these two are also likely to be set by user's login
shell, especially the shimmed `bats` (which calls `asdf_cmd()`) command
will eventually set them to user's actual in-use ones, causing conflicts
with the temporary test setup.
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.

2 participants