rakeshadr commented on code in PR #3277:
URL: https://github.com/apache/ozone/pull/3277#discussion_r845778394


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/ratis/TestOzoneManagerRatisRequest.java:
##########
@@ -58,14 +61,29 @@ public void testRequestWithNonExistentBucket()
 
     String volumeName = "vol1";
     String bucketName = "invalidBuck";
+
+    // Add entry to Volume Table.
+    omMetadataManager.getVolumeTable().addCacheEntry(
+        new CacheKey<>(omMetadataManager.getVolumeKey(volumeName)),
+        new CacheValue<>(
+            Optional.of(
+                OmVolumeArgs.newBuilder()
+                    .setVolume(volumeName)
+                    .setOwnerName("owner")
+                    .setAdminName("admin")
+                    .build()), 100L));
+
     OzoneManagerProtocolProtos.OMRequest omRequest = OMRequestTestUtils
         .createCompleteMPURequest(volumeName, bucketName, "mpuKey", "mpuKeyID",
             new ArrayList<>());
 
-    OMClientRequest req =
-        OzoneManagerRatisUtils.createClientRequest(omRequest, ozoneManager);
-    Assert.assertNotNull(req);
-    Assert.assertTrue("Unexpected request on invalid bucket",
-        req instanceof S3MultipartUploadCompleteRequest);
+    try {
+      // Request creation flow should throw exception if the bucket associated
+      // with the request doesn't exist.
+      OzoneManagerRatisUtils.createClientRequest(omRequest, ozoneManager);
+      fail("Expected OMException: Bucket not found");
+    } catch (OMException oe) {
+      // Expected exception.

Review Comment:
   Can you add an assertion inside the catch block.
   
         // Expected exception
         Assert.assertEquals(OMException.ResultCodes.BUCKET_NOT_FOUND,
             oe.getResult());



-- 
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