-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-13081. Add S3 Object tagging tests #9457
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
base: master
Are you sure you want to change the base?
Conversation
Gargi-jais11
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @0lai0 for the patch.
I have few more test case suggestions which could be added.
...gration-test-s3/src/test/java/org/apache/hadoop/ozone/s3/awssdk/v2/AbstractS3SDKV2Tests.java
Outdated
Show resolved
Hide resolved
|
More Edge Cases which can be tested:
|
Tejaskriya
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @0lai0 , I second the suggestion of @Gargi-jais11 , the tests added mostly look good, but they are mainly the positive cases. Can we add tests for the error cases?
Also, multiple related test cases could be put in one test method to avoid duplication.
Yes correct @Tejaskriya above test cases can be added to check for error cases. |
|
Thanks @Gargi-jais11 and @Tejaskriya review, I'll add error cases. |
ivandika3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the tests. Overall LGTM. Could you also add similar tests to the AbstractS3SDKV1Tests as well?
Please also help to check this failure in your latest test run https://github.com/0lai0/ozone/actions/runs/20160679799/job/57874354964
(org.apache.hadoop.ozone.s3.awssdk.v2.AbstractS3SDKV2Tests$S3BucketOwnershipVerificationConditionsTests$LinkBucketTests)
|
@0lai0 Thanks for updating the patch. It LGTM.
Once this is done the patch will be good to go. |
...gration-test-s3/src/test/java/org/apache/hadoop/ozone/s3/awssdk/v2/AbstractS3SDKV2Tests.java
Outdated
Show resolved
Hide resolved
...gration-test-s3/src/test/java/org/apache/hadoop/ozone/s3/awssdk/v2/AbstractS3SDKV2Tests.java
Outdated
Show resolved
Hide resolved
...gration-test-s3/src/test/java/org/apache/hadoop/ozone/s3/awssdk/v2/AbstractS3SDKV2Tests.java
Outdated
Show resolved
Hide resolved
...gration-test-s3/src/test/java/org/apache/hadoop/ozone/s3/awssdk/v2/AbstractS3SDKV2Tests.java
Outdated
Show resolved
Hide resolved
|
Thanks @ivandika3, @Gargi-jais11 and @echonesis for review.I'll push a fix right away. |
|
Thanks @0lai0 , left some comments. |
echonesis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @0lai0 for updating the patch, left some comments.
|
|
||
| @Nested | ||
| @TestInstance(TestInstance.Lifecycle.PER_CLASS) | ||
| class BucketOwnershipLinkBucketTests { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could keep it consistent with the V2 class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we should keep the name consistent with the V2 class as LinkBucketTests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll get on this.
| * | ||
| */ | ||
| @TestMethodOrder(MethodOrderer.MethodName.class) | ||
| public abstract class AbstractS3SDKV1Tests extends OzoneTestBase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removal of OzoneTestBase should be consistent between V1 and V2.
The V2 version still extends OzoneTestBase, so getTestName() returns a fixed test method name instead of a random string. This could cause naming conflicts in parallel test execution.
Consider removing OzoneTestBase from V2 as well and adding the same random-based getTestName() method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe AbstractS3SDKV1Tests should extend OzoneTestBase .
OzoneTestBase.getTestName() returns the actual test method name (e.g., "testCreateBucket"), ensuring unique resource names per test
- Without it, tests may interfere with each other and debugging becomes difficult
- This is a standard pattern used across all Ozone test classes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is test name may not be unique (e.g. for parameterized test). #9517 adds a method in OzoneTestBase to help with that, and changes these S3 tests to use uniqueObjectName() instead of just getTestName().
+1 for keeping OzoneTestBase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0lai0 HDDS-14197 is merged, now you can keep extends OzoneTestBase here and don't need to implement custom getTestName().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks everyone for the discussion, and thanks @adoroszlai for the update on HDDS-14197. I'll keep OzoneTestBase and remove the custom getTestName() implementation.
Gargi-jais11
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments below.
| .withExpectedBucketOwner("wrong-owner"); | ||
| AmazonServiceException wrongOwner = assertThrows(AmazonServiceException.class, | ||
| () -> s3Client.getBucketAcl(wrongRequest)); | ||
| assertEquals(403, wrongOwner.getStatusCode()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use HttpURLConnection.HTTP_FORBIDDEN
| .withExpectedBucketOwner("wrong-owner"); | ||
| AmazonServiceException wrongOwner = assertThrows(AmazonServiceException.class, | ||
| () -> s3Client.getBucketAcl(wrongRequest)); | ||
| assertEquals(403, wrongOwner.getStatusCode()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use HttpURLConnection.HTTP_FORBIDDEN
| 400 | ||
| ), | ||
| Arguments.of( | ||
| Arrays.asList(Tag.builder().key("valid-key").value(repeatChar('b', 257)).build()), | ||
| 400 | ||
| ), | ||
| Arguments.of( | ||
| Arrays.asList(Tag.builder().key("t$ag@#invalid").value("value").build()), | ||
| 400 | ||
| ), | ||
| Arguments.of( | ||
| Arrays.asList(Tag.builder().key("aws:test").value("value").build()), | ||
| 400 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use HTTP_BAD_REQUEST in this Parameterised test.
| private String getTestName() { | ||
| return RandomStringUtils.secure().nextAlphanumeric(8).toLowerCase(Locale.ROOT); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0lai0 is there any specific purpose because of which you are creating getTestName explicity over here and not using OzoneTestBase#getTestName?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for point this out , I'll remove it.
|
@0lai0 After addressing the review comments please mark it as resolved. |
@Gargi-jais11 IMO the responsibility of resolving comments is in the reviewer since it signals that that the comments are already addressed to the reviewer's satisfaction. |
|
Thanks for all the feedback. I'll review and make changes based on the comments. |
|
Thanks @0lai0 for updating the patch. There are some test failures: https://github.com/0lai0/ozone/actions/runs/20396880835/job/58614335876#step:13:6020 |
|
Thanks @adoroszlai for review. I've pushed a commit to address test failures by AssertionFailedError. |
What changes were proposed in this pull request?
Adding PutObjectTagging, GetObjectTagging, DeleteObjectTagging SDK integration tests to validate.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-13081