You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "kostacie (via GitHub)" <gi...@apache.org> on 2025/04/17 13:38:38 UTC
[PR] HDDS-10284. Replace GenericTestUtils temp dir in MiniOzoneCluster [ozone]
kostacie opened a new pull request, #8300:
URL: https://github.com/apache/ozone/pull/8300
## What changes were proposed in this pull request?
This PR deletes `GenericTestUtils#getTempPath` and adds this method to `MiniOzoneCluster` instead of using TempDir annotation.
`GenericTestUtils#getTempPath` was moved to `MiniOzoneCluster` as there were only two usages of it (both are in `MiniOzoneCluster`). Thus adding extra TempDir annotation to `MiniOzoneClusterTest` is redundant and it's not necessary to delete `getTempPath()` from the test in which it is used.
## What is the link to the Apache JIR[A
[HDDS-10284](https://issues.apache.org/jira/browse/HDDS-10284)
## How was this patch tested?
CI:
https://github.com/kostacie/ozone/actions/runs/14514707121
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10284. Replace GenericTestUtils temp dir in MiniOzoneCluster [ozone]
Posted by "kostacie (via GitHub)" <gi...@apache.org>.
kostacie commented on code in PR #8300:
URL: https://github.com/apache/ozone/pull/8300#discussion_r2050211477
##########
hadoop-hdds/test-utils/src/test/java/org/apache/ozone/test/GenericTestUtils.java:
##########
@@ -133,7 +107,7 @@ public static String getTempPath(String subpath) {
* @throws InterruptedException if the method is interrupted while waiting
*/
public static void waitFor(BooleanSupplier check, int checkEveryMillis,
- int waitForMillis) throws TimeoutException, InterruptedException {
+ int waitForMillis) throws TimeoutException, InterruptedException {
Review Comment:
Thank you for the review. Yes, I'll revert the format changes and take into account that they should be avoided.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10284. Replace GenericTestUtils temp dir in MiniOzoneCluster [ozone]
Posted by "myskov (via GitHub)" <gi...@apache.org>.
myskov commented on code in PR #8300:
URL: https://github.com/apache/ozone/pull/8300#discussion_r2050397591
##########
hadoop-hdds/test-utils/src/test/java/org/apache/ozone/test/GenericTestUtils.java:
##########
@@ -56,9 +56,8 @@
* Provides some very generic helpers which might be used across the tests.
*/
public abstract class GenericTestUtils {
- public static final String SYSPROP_TEST_DATA_DIR = "test.build.data";
public static final String DEFAULT_TEST_DATA_DIR;
Review Comment:
it seems `DEFAULT_TEST_DATA_DIR ` can be removed as well, it's not used anymore
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10284. Replace GenericTestUtils temp dir in MiniOzoneCluster [ozone]
Posted by "myskov (via GitHub)" <gi...@apache.org>.
myskov commented on code in PR #8300:
URL: https://github.com/apache/ozone/pull/8300#discussion_r2050135430
##########
hadoop-hdds/test-utils/src/test/java/org/apache/ozone/test/GenericTestUtils.java:
##########
@@ -133,7 +107,7 @@ public static String getTempPath(String subpath) {
* @throws InterruptedException if the method is interrupted while waiting
*/
public static void waitFor(BooleanSupplier check, int checkEveryMillis,
- int waitForMillis) throws TimeoutException, InterruptedException {
+ int waitForMillis) throws TimeoutException, InterruptedException {
Review Comment:
let's do not format changes that are not related to the jira ticket
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10284. Replace GenericTestUtils temp dir in MiniOzoneCluster [ozone]
Posted by "kostacie (via GitHub)" <gi...@apache.org>.
kostacie commented on code in PR #8300:
URL: https://github.com/apache/ozone/pull/8300#discussion_r2050452987
##########
hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneCluster.java:
##########
@@ -250,7 +252,29 @@ default String getName() {
}
default String getBaseDir() {
- return GenericTestUtils.getTempPath(getName());
+ return getTempPath(getName());
+ }
+
+ /**
+ * Get a temp path. This may or may not be relative; it depends on what the
+ * {@link #SYSPROP_TEST_DATA_DIR} is set to. If unset, it returns a path
+ * under the relative path {@link #DEFAULT_TEST_DATA_PATH}
+ *
+ * @param subpath sub path, with no leading "/" character
+ * @return a string to use in paths
+ */
+ static String getTempPath(String subpath) {
+ String prop = WINDOWS ? DEFAULT_TEST_DATA_PATH
+ : System.getProperty(SYSPROP_TEST_DATA_DIR, DEFAULT_TEST_DATA_PATH);
+
+ if (prop.isEmpty()) {
+ // corner case: property is there but empty
+ prop = DEFAULT_TEST_DATA_PATH;
+ }
+ if (!prop.endsWith("/")) {
+ prop = prop + "/";
+ }
+ return prop + subpath;
}
Review Comment:
Thank you for the suggestion
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10284. Replace GenericTestUtils temp dir in MiniOzoneCluster [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #8300:
URL: https://github.com/apache/ozone/pull/8300#discussion_r2050420745
##########
hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneCluster.java:
##########
@@ -250,7 +252,29 @@ default String getName() {
}
default String getBaseDir() {
- return GenericTestUtils.getTempPath(getName());
+ return getTempPath(getName());
+ }
+
+ /**
+ * Get a temp path. This may or may not be relative; it depends on what the
+ * {@link #SYSPROP_TEST_DATA_DIR} is set to. If unset, it returns a path
+ * under the relative path {@link #DEFAULT_TEST_DATA_PATH}
+ *
+ * @param subpath sub path, with no leading "/" character
+ * @return a string to use in paths
+ */
+ static String getTempPath(String subpath) {
+ String prop = WINDOWS ? DEFAULT_TEST_DATA_PATH
+ : System.getProperty(SYSPROP_TEST_DATA_DIR, DEFAULT_TEST_DATA_PATH);
+
+ if (prop.isEmpty()) {
+ // corner case: property is there but empty
+ prop = DEFAULT_TEST_DATA_PATH;
+ }
+ if (!prop.endsWith("/")) {
+ prop = prop + "/";
+ }
+ return prop + subpath;
}
Review Comment:
I suggest moving the method as `protected` and related constants as `private` to `MiniOzoneCluster.Builder` for a cleaner `MiniOzoneCluster` interface.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10284. Move GenericTestUtils#getTempPath to MiniOzoneCluster [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #8300:
URL: https://github.com/apache/ozone/pull/8300
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10284. Replace GenericTestUtils temp dir in MiniOzoneCluster [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #8300:
URL: https://github.com/apache/ozone/pull/8300#discussion_r2050189855
##########
hadoop-hdds/test-utils/src/test/java/org/apache/ozone/test/GenericTestUtils.java:
##########
@@ -133,7 +107,7 @@ public static String getTempPath(String subpath) {
* @throws InterruptedException if the method is interrupted while waiting
*/
public static void waitFor(BooleanSupplier check, int checkEveryMillis,
- int waitForMillis) throws TimeoutException, InterruptedException {
+ int waitForMillis) throws TimeoutException, InterruptedException {
Review Comment:
In addition to being unrelated, this specific formatting should be avoided. Whenever visibility / return type / method name / other modifiers are changed, we would have to reindent all parameters.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10284. Move GenericTestUtils#getTempPath to MiniOzoneCluster [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #8300:
URL: https://github.com/apache/ozone/pull/8300#issuecomment-2815462539
Thanks @kostacie for the patch, @myskov for the review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org