ddanielr commented on code in PR #4092:
URL: https://github.com/apache/accumulo/pull/4092#discussion_r1433149390


##########
core/src/test/java/org/apache/accumulo/core/spi/compaction/DefaultCompactionPlannerTest.java:
##########
@@ -239,6 +243,38 @@ public void testMaxSize() {
     assertEquals(CompactionExecutorIdImpl.externalId("large"), 
job.getExecutor());
   }
 
+  /**
+   * Tests max.open can be overridden with maxOpen.
+   */
+  @Test
+  @SuppressWarnings("removal")
+  public void testOverrideMaxOpen() {
+    DefaultCompactionPlanner planner = new DefaultCompactionPlanner();
+    ConfigurationCopy aconf = new 
ConfigurationCopy(DefaultConfiguration.getInstance());
+    aconf.set(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), "5");
+
+    ConfigurationImpl config = new ConfigurationImpl(aconf);
+
+    ServiceEnvironment senv = EasyMock.createMock(ServiceEnvironment.class);
+    EasyMock.expect(senv.getConfiguration()).andReturn(config).anyTimes();
+    EasyMock.replay(senv);
+
+    String executors = getExecutors("'type': 
'internal','maxSize':'32M','numThreads':1",
+        "'type': 'internal','maxSize':'128M','numThreads':2", "'type': 
'external','queue':'q1'");
+
+    // Test with max.open property
+    planner.init(getInitParams(senv, executors, "15"));
+    assertEquals(5, planner.getMaxFilesToCompact());

Review Comment:
   I ended up refactoring the compaction tests in DefaultCompactionPlannerTest 
to use a default conf and then set the property prior to compacting for tests 
that checked the plan files.
   
   This cuts down on the amount of custom test code we were using while also 
getting these tests closer to mimicking a real-world situation. 
   



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