milleruntime commented on a change in pull request #1614:
URL: https://github.com/apache/accumulo/pull/1614#discussion_r429355678



##########
File path: test/src/main/java/org/apache/accumulo/test/functional/BulkNewIT.java
##########
@@ -186,18 +186,26 @@ public void testSingleTabletSingleFileOffline() throws 
Exception {
 
   @Test
   public void testMaxTablets() throws Exception {
-    String maxTablets = "0";
+    // test max tablets hit while inspecting bulk files
     try (AccumuloClient client = 
Accumulo.newClient().from(getClientProps()).build()) {
-      maxTablets = client.instanceOperations().getSystemConfiguration()
-          .get(Property.MASTER_BULK_MAX_TABLETS.getKey());
-      
client.instanceOperations().setProperty(Property.MASTER_BULK_MAX_TABLETS.getKey(),
 "1");
+      tableName = "testMaxTablets_table1";
+      NewTableConfiguration newTableConf = new NewTableConfiguration();
+      // set logical time type so we can set time on bulk import
+      Map<String,String> props = new HashMap<>();
+      props.put(Property.TABLE_BULK_MAX_TABLETS.getKey(), "1");
+      newTableConf.setProperties(props);
+      client.tableOperations().create(tableName, newTableConf);
       testBulkFile(false, false);
-      fail("Expected IllegalArgumentException for " + 
Property.MASTER_BULK_MAX_TABLETS);
-    } catch (IllegalArgumentException e) {} finally {
-      try (AccumuloClient client = 
Accumulo.newClient().from(getClientProps()).build()) {
-        
client.instanceOperations().setProperty(Property.MASTER_BULK_MAX_TABLETS.getKey(),
-            maxTablets);
-      }
+      fail("Expected IllegalArgumentException for " + 
Property.TABLE_BULK_MAX_TABLETS);
+    } catch (IllegalArgumentException e) {
+      // expected
+    }
+    // test max tablets hit using load plan
+    try {
+      testBulkFile(false, true);
+      fail("Expected IllegalArgumentException for " + 
Property.TABLE_BULK_MAX_TABLETS);
+    } catch (IllegalArgumentException e) {
+      // expected
     }

Review comment:
       I settled with keeping the exception handling the way it is now.  I was 
able to clean up the IT using assertThrows and just checked the causes 
manually.  I think this is as clean as it is going to get until we move to 
Junit5.  I did find this library which I thought was interesting: 
https://assertj.github.io/doc/




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

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


Reply via email to