You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "chiacyu (via GitHub)" <gi...@apache.org> on 2025/03/08 03:48:26 UTC
[PR] HDDS-12476. Add TestDataUtil#createKey variant with small random content [ozone]
chiacyu opened a new pull request, #8028:
URL: https://github.com/apache/ozone/pull/8028
## What changes were proposed in this pull request?
Several callers of `TestDataUtil#createKey` just want to write some data, without any interest in the content being written. The goal of this task is to create a variant of the method which generates some small random `byte[] content` instead of accepting it via parameter. To let the caller verify data (e.g. via `readKey`), this variant of `createKey` should return the random content it generated. Please take a look, thanks!
## What is the link to the Apache JIRA
[HDDS-12476](https://issues.apache.org/jira/browse/HDDS-12476)
## How was this patch tested?
Tested by CI.
--
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-12476. Add TestDataUtil#createKey variant with small random content [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #8028:
URL: https://github.com/apache/ozone/pull/8028
--
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-12476. Add TestDataUtil#createKey variant with small random content [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #8028:
URL: https://github.com/apache/ozone/pull/8028#discussion_r1985990736
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestDataUtil.java:
##########
@@ -104,6 +105,14 @@ public static OzoneVolume createVolume(OzoneClient client,
}
+ public static byte[] createKey(OzoneBucket bucket,
+ String keyName, int length) throws IOException {
+ byte[] content = RandomStringUtils.random(length, 0, 0,
+ true, true, null, new SecureRandom()).getBytes(UTF_8);
Review Comment:
- Let's clarify that this method generates string content by renaming to `createStringKey`.
- Please avoid `new SecureRandom()` or `new Random()` for single use. Replace with `RandomStringUtils.secure().nextAlphanumeric(length).getBytes(UTF_8)`.
- nit: Please do not format method signature like this. 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