Skip to content

test: use T.TempDir to create temporary test directory#1308

Merged
dcantah merged 2 commits intomicrosoft:masterfrom
Juneezee:test/t.TempDir
Mar 1, 2022
Merged

test: use T.TempDir to create temporary test directory#1308
dcantah merged 2 commits intomicrosoft:masterfrom
Juneezee:test/t.TempDir

Conversation

@Juneezee
Copy link
Copy Markdown
Contributor

A small testing enhancement.

We can use the T.TempDir function from the testing package to create temporary directory. The directory created by T.TempDir is automatically removed when the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir

The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
@Juneezee Juneezee requested a review from a team as a code owner February 26, 2022 09:20
@anmaxvl
Copy link
Copy Markdown
Contributor

anmaxvl commented Mar 1, 2022

Thanks for the PR!

Copy link
Copy Markdown
Contributor

@dcantah dcantah left a comment

Choose a reason for hiding this comment

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

This is great, thanks! One comment

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
@dcantah dcantah merged commit 643ef46 into microsoft:master Mar 1, 2022
princepereira pushed a commit to princepereira/hcsshim that referenced this pull request Aug 29, 2024
)

* test: use `T.TempDir` to create temporary test directory

The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
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