Skip to content

HDDS-15277. Refactor TestContainerDataYaml to ensure proper resource cleanup#10275

Merged
adoroszlai merged 3 commits into
apache:masterfrom
hevinhsu:HDDS-15277
May 18, 2026
Merged

HDDS-15277. Refactor TestContainerDataYaml to ensure proper resource cleanup#10275
adoroszlai merged 3 commits into
apache:masterfrom
hevinhsu:HDDS-15277

Conversation

@hevinhsu
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Refactor TestContainerDataYaml to use JUnit 5 @TempDir for temporary file management.

Previously, the test relied on a shared static test directory created via FileSystemTestHelper#getTestRootDir() and manually cleaned it up using FileUtil.fullyDelete(...).

This change replaces the manual lifecycle management with @TempDir, so each test gets an isolated temporary directory and the framework automatically handles cleanup after test execution.

This removes shared state between tests and makes cleanup more reliable when assertions fail or unexpected exceptions occur.

This ensures cleanup always happens while keeping test behavior isolated and deterministic.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-15277

How was this patch tested?

https://github.com/hevinhsu/ozone/actions/runs/25904967962

@adoroszlai adoroszlai requested a review from chungen0126 May 16, 2026 11:14
Copy link
Copy Markdown
Contributor

@chungen0126 chungen0126 left a comment

Choose a reason for hiding this comment

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

+1 LGTM

@adoroszlai adoroszlai merged commit 8a1de74 into apache:master May 18, 2026
32 checks passed
@adoroszlai
Copy link
Copy Markdown
Contributor

Thanks @hevinhsu for the patch, @chungen0126 for the review.

@hevinhsu
Copy link
Copy Markdown
Contributor Author

Thanks @chungen0126 for the review, @adoroszlai for the merge.

@hevinhsu hevinhsu deleted the HDDS-15277 branch May 20, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants