You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Attila Doroszlai (Jira)" <ji...@apache.org> on 2024/01/19 14:49:00 UTC

[jira] [Updated] (HDDS-9103) Replace GenericTestUtils temp directories with @TempDir

     [ https://issues.apache.org/jira/browse/HDDS-9103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Attila Doroszlai updated HDDS-9103:
-----------------------------------
    Description: 
Replace temporary directory functionality of {{GenericTestUtils}} with JUnit's {{[\@TempDir|https://junit.org/junit5/docs/current/user-guide/#writing-tests-built-in-extensions-TempDirectory]}}.  The latter is automatically cleaned up.

* Usage of {{File getRandomizedTestDir()}}, {{File getTestDir()}}, and {{File getTestDir(String)}} can be directly replaced by {{@TempDir}}.  If the temp directory is stored in a local variable, convert it to a field for it.
* For usages of {{String getRandomizedTempPath()}} and {{String getTempPath(String)}} we still need to add a {{Path}} or {{File}} as a field, and use {{toString()}} where needed.
* Post-test deletion of the dir can be removed.
* If {{@BeforeEach}} and {{@AfterEach}} methods are only used to create/delete the dir, they can be deleted as well.
* Any unused imports should be removed.

  was:Replace temporary directory functionality of {{GenericTestUtils}} with JUnit's {{[\@TempDir|https://junit.org/junit5/docs/current/user-guide/#writing-tests-built-in-extensions-TempDirectory]}}.  The latter is automatically cleaned up.


> Replace GenericTestUtils temp directories with @TempDir
> -------------------------------------------------------
>
>                 Key: HDDS-9103
>                 URL: https://issues.apache.org/jira/browse/HDDS-9103
>             Project: Apache Ozone
>          Issue Type: Improvement
>          Components: test
>            Reporter: Attila Doroszlai
>            Assignee: Attila Doroszlai
>            Priority: Major
>
> Replace temporary directory functionality of {{GenericTestUtils}} with JUnit's {{[\@TempDir|https://junit.org/junit5/docs/current/user-guide/#writing-tests-built-in-extensions-TempDirectory]}}.  The latter is automatically cleaned up.
> * Usage of {{File getRandomizedTestDir()}}, {{File getTestDir()}}, and {{File getTestDir(String)}} can be directly replaced by {{@TempDir}}.  If the temp directory is stored in a local variable, convert it to a field for it.
> * For usages of {{String getRandomizedTempPath()}} and {{String getTempPath(String)}} we still need to add a {{Path}} or {{File}} as a field, and use {{toString()}} where needed.
> * Post-test deletion of the dir can be removed.
> * If {{@BeforeEach}} and {{@AfterEach}} methods are only used to create/delete the dir, they can be deleted as well.
> * Any unused imports should be removed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org