X Tutup
Skip to content

Use T.TempDir for temporary dirs in tests#3580

Merged
mislav merged 3 commits intocli:trunkfrom
cristiand391:tests-tempdir
May 7, 2021
Merged

Use T.TempDir for temporary dirs in tests#3580
mislav merged 3 commits intocli:trunkfrom
cristiand391:tests-tempdir

Conversation

@cristiand391
Copy link
Copy Markdown
Contributor

@cristiand391 cristiand391 commented May 4, 2021

This PR removes the use of os.TempDir in tests in favor of T.TempDir.

Unlike os.TempDir, T.TempDir return temporary directories that are automatically cleaned up at the end of the test so there's no need to register cleanup functions.

Note that this method was introduced in Go 1.15 which is the minimum required version for running the test suite.

@cliAutomation
Copy link
Copy Markdown
Collaborator

Hi! Thanks for the pull request. Please ensure that this change is linked to an issue by mentioning an issue number in the description of the pull request. If this pull request would close the issue, please put the word 'Fixes' before the issue number somewhere in the pull request body. If this is a tiny change like fixing a typo, feel free to ignore this message.

@cristiand391 cristiand391 changed the title Use T.TempDir for temporal dirs in tests Use T.TempDir for temporary dirs in tests May 5, 2021
Copy link
Copy Markdown
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Thank you for looking out for tests!

@cristiand391 cristiand391 requested a review from mislav May 6, 2021 22:54
@cristiand391
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback, I've pushed some updates 👍🏾

Copy link
Copy Markdown
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Looks great; thank you!

@mislav mislav merged commit 2f94ada into cli:trunk May 7, 2021
@cristiand391 cristiand391 deleted the tests-tempdir branch May 7, 2021 11:31
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

X Tutup