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

fix(tests): prevent test git commands from modifying local files #3262

Merged
merged 1 commit into from Mar 24, 2023

Conversation

finnag
Copy link
Contributor

@finnag finnag commented Mar 24, 2023

what

Tests no longer write to .gitconfig and .git-credentials in $HOME.

why

Tests should not write to git configuration files directly in the user's home directory.

tests

  • I have tested my changes by make test-all

Rreproduction steps to see the problem (fails without this patch):

touch $HOME/.gitconfig $HOME/.git-credentials
sudo chattr -i $HOME/.gitconfig $HOME/.git-credentials
make test

references

closes #2604

The tests would mutate $HOME/.gitconfig and $HOME/.git-credentials.
Set the HOME environment variable to a suitable temporary
directory before running git commands that mutate the global config.

Fixes runatlantis#2604
@finnag finnag requested a review from a team as a code owner March 24, 2023 21:33
@github-actions github-actions bot added the go Pull requests that update Go code label Mar 24, 2023
@jamengual jamengual merged commit ff5894c into runatlantis:main Mar 24, 2023
10 checks passed
@jamengual
Copy link
Contributor

thanks @finnag

@nitrocode nitrocode added this to the v0.23.4 milestone Mar 25, 2023
@nitrocode nitrocode changed the title Tests should update only test-local git configuration files fix(tests): prevent test git commands from modifying local files Apr 1, 2023
nitrocode pushed a commit that referenced this pull request May 5, 2023
The tests would mutate $HOME/.gitconfig and $HOME/.git-credentials.
Set the HOME environment variable to a suitable temporary
directory before running git commands that mutate the global config.

Fixes #2604
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
)

The tests would mutate $HOME/.gitconfig and $HOME/.git-credentials.
Set the HOME environment variable to a suitable temporary
directory before running git commands that mutate the global config.

Fixes runatlantis#2604
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
)

The tests would mutate $HOME/.gitconfig and $HOME/.git-credentials.
Set the HOME environment variable to a suitable temporary
directory before running git commands that mutate the global config.

Fixes runatlantis#2604
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running the test suite writes garbage to ~/.gitconfig
3 participants