guluo2016 commented on code in PR #7195:
URL: https://github.com/apache/hbase/pull/7195#discussion_r2267273940


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestTakeSnapshotHandler.java:
##########
@@ -100,6 +101,14 @@ public void testPreparePreserveMaxFileSizeDisabled() 
throws Exception {
     assertEquals(-1, UTIL.getAdmin().getDescriptor(cloned).getMaxFileSize());
   }
 
+  @Test(expected = HBaseSnapshotException.class)

Review Comment:
   The exception was wrapped and reconstructed as its superclass, causing the 
original subclass type information to be lost—this is likely the cause.
   Perhaps we can do it like this.
   ```
   @Test
   public void testSnapshotEarlyExpiration() throws Exception {
     UTIL.startMiniCluster();
     Map<String, Object> snapshotProps = new HashMap<>();
     snapshotProps.put("TTL", 1L);
     HBaseSnapshotException hBaseSnapshotException = 
assertThrows(HBaseSnapshotException.class, () -> 
createTableInsertDataAndTakeSnapshot(snapshotProps));
     
assertTrue(hBaseSnapshotException.toString().contains(SnapshotTTLExpiredException.class.getName()));
     assertTrue(hBaseSnapshotException.getMessage().contains("has already 
expired"));
   }
   ```
   And I tested it locally and it works as expected.



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

Reply via email to