Skip to content

Commit e19b288

Browse files
authored
Improve several ITs (#5370)
Convert AccumuloInputFormatIT, ZooKeeperPropertiesIT, and AmpleConditionalWriterIT to use SharedMiniClusterBase in order to speed them up. Also broke out one of the test cases in AmpleConditionalWriterIT that required the use of AccumuloClusterHarness. Also included other misc. improvements to various test cases.
1 parent 410ece4 commit e19b288

File tree

6 files changed

+880
-844
lines changed

6 files changed

+880
-844
lines changed

hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloInputFormatIT.java

+13-6
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
import org.apache.accumulo.hadoop.mapreduce.InputFormatBuilder.InputFormatOptions;
5454
import org.apache.accumulo.hadoopImpl.mapreduce.BatchInputSplit;
5555
import org.apache.accumulo.hadoopImpl.mapreduce.RangeInputSplit;
56-
import org.apache.accumulo.harness.AccumuloClusterHarness;
57-
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
56+
import org.apache.accumulo.harness.SharedMiniClusterBase;
5857
import org.apache.hadoop.conf.Configuration;
5958
import org.apache.hadoop.conf.Configured;
6059
import org.apache.hadoop.io.Text;
@@ -66,7 +65,9 @@
6665
import org.apache.hadoop.mapreduce.lib.output.NullOutputFormat;
6766
import org.apache.hadoop.util.Tool;
6867
import org.apache.hadoop.util.ToolRunner;
68+
import org.junit.jupiter.api.AfterAll;
6969
import org.junit.jupiter.api.AfterEach;
70+
import org.junit.jupiter.api.BeforeAll;
7071
import org.junit.jupiter.api.BeforeEach;
7172
import org.junit.jupiter.api.Test;
7273

@@ -78,7 +79,7 @@
7879
*
7980
* @since 2.0
8081
*/
81-
public class AccumuloInputFormatIT extends AccumuloClusterHarness {
82+
public class AccumuloInputFormatIT extends SharedMiniClusterBase {
8283

8384
AccumuloInputFormat inputFormat;
8485
AccumuloClient client;
@@ -88,9 +89,15 @@ protected Duration defaultTimeout() {
8889
return Duration.ofMinutes(4);
8990
}
9091

91-
@Override
92-
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
93-
cfg.getClusterServerConfiguration().setNumDefaultTabletServers(1);
92+
@BeforeAll
93+
public static void setup() throws Exception {
94+
SharedMiniClusterBase.startMiniClusterWithConfig(
95+
(cfg, coreSite) -> cfg.getClusterServerConfiguration().setNumDefaultTabletServers(1));
96+
}
97+
98+
@AfterAll
99+
public static void teardown() {
100+
SharedMiniClusterBase.stopMiniCluster();
94101
}
95102

96103
@BeforeEach

test/src/main/java/org/apache/accumulo/test/ZooKeeperPropertiesIT.java

+16-4
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,27 @@
3636
import org.apache.accumulo.core.conf.Property;
3737
import org.apache.accumulo.core.data.NamespaceId;
3838
import org.apache.accumulo.core.data.TableId;
39-
import org.apache.accumulo.harness.AccumuloClusterHarness;
39+
import org.apache.accumulo.harness.SharedMiniClusterBase;
4040
import org.apache.accumulo.server.ServerContext;
4141
import org.apache.accumulo.server.conf.store.NamespacePropKey;
4242
import org.apache.accumulo.server.conf.store.TablePropKey;
4343
import org.apache.accumulo.server.util.PropUtil;
44+
import org.junit.jupiter.api.AfterAll;
45+
import org.junit.jupiter.api.BeforeAll;
4446
import org.junit.jupiter.api.Test;
4547
import org.junit.jupiter.api.Timeout;
4648

47-
public class ZooKeeperPropertiesIT extends AccumuloClusterHarness {
49+
public class ZooKeeperPropertiesIT extends SharedMiniClusterBase {
50+
51+
@BeforeAll
52+
public static void setup() throws Exception {
53+
SharedMiniClusterBase.startMiniCluster();
54+
}
55+
56+
@AfterAll
57+
public static void teardown() {
58+
SharedMiniClusterBase.stopMiniCluster();
59+
}
4860

4961
@Test
5062
public void testNoFiles() {
@@ -59,7 +71,7 @@ public void testNoFiles() {
5971
@Timeout(30)
6072
public void testTablePropUtils() throws AccumuloException, TableExistsException,
6173
AccumuloSecurityException, TableNotFoundException {
62-
ServerContext context = getServerContext();
74+
ServerContext context = getCluster().getServerContext();
6375

6476
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
6577

@@ -111,7 +123,7 @@ public void testTablePropUtils() throws AccumuloException, TableExistsException,
111123
@Timeout(30)
112124
public void testNamespacePropUtils() throws AccumuloException, AccumuloSecurityException,
113125
NamespaceExistsException, NamespaceNotFoundException {
114-
ServerContext context = getServerContext();
126+
ServerContext context = getCluster().getServerContext();
115127

116128
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
117129

0 commit comments

Comments
 (0)