keith-turner commented on a change in pull request #1614:
URL: https://github.com/apache/accumulo/pull/1614#discussion_r428938795
##########
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 recently learned about this new feature in Junit. It also returns the
expected exception if you want to check the message.
```suggestion
Assert.assertThrows(IllegalArgumentException.class, () ->
testBulkFile(false, true));
```
----------------------------------------------------------------
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]