Gargi-jais11 commented on PR #9457:
URL: https://github.com/apache/ozone/pull/9457#issuecomment-3624770967

   More Edge Cases which can be tested:
   
   1. `testPutObjectTaggingExceedsLimit()` — Test 11 tags and validate it 
throws error there is 10-tag limit.
   2. `testPutObjectTaggingReplacesExistingTags()` — verifies replacement 
behavior (Initially put 2 tags then replace it with 1 tag and check the last 
replcaed tag is only applied)
   3. `testPutObjectTaggingInvalidConstraints` - This can be a  **parameterised 
test** like below:
   ```
   private static Stream<Arguments> invalidTagConstraintsProvider() {
       return Stream.of(
           // Test 1: Tag key exceeds maximum length (128 bytes)
           Arguments.of(
               "Tag key exceeding 128 bytes should be rejected",
               
Arrays.asList(Tag.builder().key("a".repeat(129)).value("value").build()),
               400,
               "exceeds the maximum length"
           ),
           
           // Test 2: Tag value exceeds maximum length (256 bytes)
           Arguments.of(
               "Tag value exceeding 256 bytes should be rejected",
               
Arrays.asList(Tag.builder().key("valid-key").value("b".repeat(257)).build()),
               400,
               "exceeds the maximum length"
           ),
           // Test 3: Tag key with invalid characters (@, #, $, (, {, ....)
           Arguments.of(
               "Tag key with invalid characters should be rejected",
               
Arrays.asList(Tag.builder().key("t$ag@#invalid").value("value").build()),
               400,
               "does not have a valid pattern"
           ), 
           // Test 4: Tag key starting with "aws:" prefix
           Arguments.of(
               "Tag key starting with 'aws:' prefix should be rejected",
               
Arrays.asList(Tag.builder().key("aws:test").value("value").build()),
               400,
               "cannot start with \"aws:\"" 
           )
       );
       }
   @ParameterizedTest
   @MethodSource("invalidTagConstraintsProvider")
   public void testPutObjectTaggingInvalidConstraints(
       String testCaseName,
       List<Tag> invalidTags,
       int expectedStatusCode,
       String expectedErrorMessage) {
       // your code
   }
   ```
   4.  `testPutAndGetObjectTaggingOnNonExistentObject()` -  Verify 
`NoSuchKeyException` occurs and **404 status code**.
   5.  `testDeleteObjectTaggingOnNonExistentObject()` - Verify 
`NoSuchKeyException` occurs and **404 status code**.
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to