Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-12348. Reuse TestDataUtil.createKey method #7971

Merged
merged 13 commits into from
Feb 28, 2025

Conversation

chiacyu
Copy link
Contributor

@chiacyu chiacyu commented Feb 26, 2025

What changes were proposed in this pull request?

The TestDataUtil.createKey can be reused in many places to reduce the code redundancy, please take a look, thanks!

What is the link to the Apache JIRA

HDDS-12348

How was this patch tested?

It can test by CI.

Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @chiacyu for the patch.

private void createKey(OzoneBucket ozoneBucket, String key, int length,
byte[] input)
private void createAndAssertKey(OzoneBucket ozoneBucket, String key, int length,
byte[] input)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Please do not format method signature like this. Whenever visibility / return type / method name / other modifiers are changed, we would have to reindent parameters.

ozoneOutputStream.write(input, 0, 10);
ozoneOutputStream.close();

createKey(ozoneBucket, key, new String(input, UTF_8));
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I haven't noticed that we write byte[] but createKey accepts String.

Instead of wrapping in new String in each call (here and the other test classes), let's create a new version of createKey in TestDataUtil that accepts byte[].

@adoroszlai adoroszlai added test code-cleanup Changes that aim to make code better, without changing functionality. labels Feb 27, 2025
@chiacyu chiacyu marked this pull request as draft February 28, 2025 07:39
Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @chiacyu for updating the patch. I think it's almost good to go.

@adoroszlai adoroszlai marked this pull request as ready for review February 28, 2025 12:32
Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @chiacyu for updating the patch, LGTM, pending CI.

@adoroszlai adoroszlai merged commit 6a9e8b1 into apache:master Feb 28, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-cleanup Changes that aim to make code better, without changing functionality. test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants