Skip to content

fix: Replaced os.MkdirTemp with t.TempDir#15860

Merged
bwplotka merged 2 commits intoprometheus:mainfrom
suryaaprakassh:IssueFix
Jan 31, 2025
Merged

fix: Replaced os.MkdirTemp with t.TempDir#15860
bwplotka merged 2 commits intoprometheus:mainfrom
suryaaprakassh:IssueFix

Conversation

@suryaaprakassh
Copy link
Copy Markdown
Contributor

Fixes #9594

  • Replace os.MkdirTemp with t.TempDir.
  • Removed the cleanup logic for os.MkdirTemp.

Signed-off-by: Surya Prakash <surya0prakash@proton.me>
@bwplotka
Copy link
Copy Markdown
Member

I see more places than just this one.

Do you mind fixing them all while you are on it? (:

image

@suryaaprakassh
Copy link
Copy Markdown
Contributor Author

I see more places than just this one.

Do you mind fixing them all while you are on it? (:

image

Sure I will fix it 👍

@suryaaprakassh suryaaprakassh marked this pull request as draft January 30, 2025 02:41
@suryaaprakassh suryaaprakassh force-pushed the IssueFix branch 2 times, most recently from c93938b to ea5078d Compare January 31, 2025 02:35
@suryaaprakassh
Copy link
Copy Markdown
Contributor Author

The current changes involve modifying every os.MkdirTemp() call to t.TempDir();. However, some of these os.MkdirTemp() calls are not located within test environments. Additionally, os.MkdirTemp() in api_test.go cannot be modified, as previously mentioned by @dgl.

@suryaaprakassh suryaaprakassh marked this pull request as ready for review January 31, 2025 03:04
Copy link
Copy Markdown
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Thanks!

@bwplotka bwplotka merged commit cb3b17a into prometheus:main Jan 31, 2025
63 checks passed
@suryaaprakassh suryaaprakassh deleted the IssueFix branch February 3, 2025 05:18
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.

Use testing.T.TempDir() instead of ioutil.TempDir() in unit tests

3 participants