Skip to content

Conversation

@michalvavrik
Copy link
Contributor

Closes:

Changes:

  • temporary files created during tests are placed in a temporary directory deleted by the testing framework
  • all the top-level temporary directories created for the tests are now deleted by the testing framework
  • pattern in the temporary directory is lost as the testing framework does not allow to add the pattern, hence we use the default temp dir name
  • test TestPermissionDenied changes the file permissions to the temporary directory, therefore we need to change it back so that the testing framework can delete the folder
  • tests in modeline_test.go that use util.WithTempDir (from pkg/util/util.go:465) are untouched because I thought it was good to use this util method in tests as well, it indirectly verifies this util method and I don't see any downside

Release Note

NONE

Closes:

- apache#6192

Changes:

- temporary files created during tests are placed in a temporary directory deleted by the testing framework
- all the top-level temporary directories created for the tests are now deleted by the testing framework
- pattern in the temporary directory is lost as the testing framework does not allow to add the pattern, hence we use the default temp dir name
- test 'TestPermissionDenied' changes the file permissions to the temporary directory, therefore we need to change it back so that the testing framework can delete the folder
Copy link
Contributor

@squakez squakez left a comment

Choose a reason for hiding this comment

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

Excellent work, thanks a lot!

@squakez squakez linked an issue Sep 1, 2025 that may be closed by this pull request
@squakez squakez merged commit b4582e0 into apache:main Sep 1, 2025
10 checks passed
@michalvavrik michalvavrik deleted the feature/use-t-temp-dir branch September 1, 2025 16:01
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 t.TempDir() in unit test

2 participants