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: fix unit tests to not overwrite existing cli config file #642

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

ykim-1
Copy link
Contributor

@ykim-1 ykim-1 commented Sep 10, 2024

📝 Description

Running unit tests caused existing config in ~/.config/linode-cli to be overwritten, this PR fixes this issue by setting the environment variable prior to the test execution so the config file will get written in temporary location. After the execution the environment variable will be reverted to original value.

✔️ How to Test

  1. unset LINODE_CLI_TOKEN
  2. make install
  3. linode-cli linodes ls - Expected to fail
  4. make testunit
  5. verify ~/.config/linode-cli is not overwritten

📷 Preview

If applicable, include a screenshot or code snippet of this change. Otherwise, please remove this section.

@ykim-1 ykim-1 requested a review from a team as a code owner September 10, 2024 22:01
@ykim-1 ykim-1 requested review from jriddle-linode and zliang-akamai and removed request for a team September 10, 2024 22:01
@ykim-1 ykim-1 added the testing for updates to the testing suite in the changelog. label Sep 10, 2024
@ykim-1 ykim-1 marked this pull request as draft September 10, 2024 22:02
@ykim-1 ykim-1 marked this pull request as ready for review September 11, 2024 18:28
@ykim-1 ykim-1 changed the title test: fix unit tests to not write to existing config file test: fix unit tests to not overwrite existing cli config file Sep 11, 2024
Copy link
Member

@zliang-akamai zliang-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, works well on my end!

Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works well on my end!

@ykim-1 ykim-1 merged commit e7efcea into linode:dev Sep 25, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing for updates to the testing suite in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants