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

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

bootleq
Copy link
Contributor

@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.
@Stratus3D
Copy link
Member

Sorry for the late review here. Looks great @bootleq ! I've encountered this issue myself, never had a chance to fix it.

@Stratus3D Stratus3D merged commit fa3d216 into asdf-vm:master Dec 17, 2024
7 checks passed
@bootleq bootleq deleted the test-unset-vars branch December 18, 2024 03:24
Stratus3D added a commit that referenced this pull request Dec 18, 2024
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.

3 participants