Skip to content

Modernize temp file creation and deletion in DeferredFileOutputStreamTest#535

Merged
garydgregory merged 2 commits into
apache:masterfrom
elharo:depre
Dec 26, 2023
Merged

Modernize temp file creation and deletion in DeferredFileOutputStreamTest#535
garydgregory merged 2 commits into
apache:masterfrom
elharo:depre

Conversation

@elharo

@elharo elharo commented Dec 24, 2023

Copy link
Copy Markdown
Contributor

While experimenting I broke some things, and consequently failing tests left some untracked temporary files scattered around my git repo. This PR uses try-with-resources, JUnit 5's @tempdir, and Java 7 Files.createTempFile to more reliably cleanup after test failures.

@garydgregory

@codecov-commenter

codecov-commenter commented Dec 24, 2023

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (72da9c2) 85.97% compared to head (f41e43a) 85.97%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #535   +/-   ##
=========================================
  Coverage     85.97%   85.97%           
  Complexity     3461     3461           
=========================================
  Files           229      229           
  Lines          8191     8191           
  Branches        959      959           
=========================================
  Hits           7042     7042           
  Misses          861      861           
  Partials        288      288           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@garydgregory

Copy link
Copy Markdown
Member

@elharo

Toward this type of effort, I refactored some tests a while back to extend AbstractTempDirTest. Perhaps this class should do the same.

@elharo

elharo commented Dec 24, 2023

Copy link
Copy Markdown
Contributor Author

Thanks. I'll look at that. The one test failure on CI looks unrelated:


Error: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy (default-deploy) on project commons-io: Failed to deploy artifacts: Could not transfer artifact commons-io:commons-io:pom:2.16.0-20231224.153125-11 from/to apache.snapshots.https (https://repository.apache.org/content/repositories/snapshots): authentication failed for https://repository.apache.org/content/repositories/snapshots/commons-io/commons-io/2.16.0-SNAPSHOT/commons-io-2.16.0-20231224.153125-11.pom, status: 401 Unauthorized -> [Help 1]

@garydgregory garydgregory changed the title more modern temp file creation and deletion More modern temp file creation and deletion Dec 26, 2023
@garydgregory garydgregory merged commit 7806142 into apache:master Dec 26, 2023
@garydgregory garydgregory changed the title More modern temp file creation and deletion Modernize temp file creation and deletion in DeferredFileOutputStreamTest Dec 26, 2023
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