accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmil...@apache.org
Subject [accumulo] branch master updated: Speed up some long running ITs (#1078)
Date Mon, 08 Apr 2019 20:12:31 GMT
This is an automated email from the ASF dual-hosted git repository.

mmiller pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 2f12d2c  Speed up some long running ITs (#1078)
2f12d2c is described below

commit 2f12d2cbb2203c5311154c1b26a28fe5208e7189
Author: Mike Miller <mmiller@apache.org>
AuthorDate: Mon Apr 8 16:12:26 2019 -0400

    Speed up some long running ITs (#1078)
    
    * Changed the base type to SharedMiniClusterBase for
    * NamespacesIT, ConditionalWriterIT and BulkLoadIT
---
 .../accumulo/harness/SharedMiniClusterBase.java    | 13 ++++++++
 .../apache/accumulo/test/ConditionalWriterIT.java  | 38 ++++++++++++++--------
 .../org/apache/accumulo/test/NamespacesIT.java     | 22 +++++++++----
 .../accumulo/test/functional/BulkLoadIT.java       | 31 +++++++++++++-----
 4 files changed, 75 insertions(+), 29 deletions(-)

diff --git a/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java b/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
index 2d2c72f..74c8cf5 100644
--- a/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
+++ b/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
@@ -28,6 +28,7 @@ import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
 import org.apache.accumulo.core.client.security.tokens.KerberosToken;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.clientImpl.ClientInfo;
 import org.apache.accumulo.core.conf.ClientProperty;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.security.TablePermission;
@@ -214,4 +215,16 @@ public abstract class SharedMiniClusterBase extends AccumuloITBase implements
Cl
       return krb.getClientPrincipal(offset);
     }
   }
+
+  public static ClientInfo getClientInfo() {
+    return ClientInfo.from(cluster.getClientProperties());
+  }
+
+  public static boolean saslEnabled() {
+    return getClientInfo().saslEnabled();
+  }
+
+  public static String getAdminPrincipal() {
+    return cluster.getConfig().getRootUserName();
+  }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
index 3508542..1f7a3e4 100644
--- a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
@@ -44,7 +44,6 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import org.apache.accumulo.cluster.AccumuloCluster;
 import org.apache.accumulo.cluster.ClusterUser;
 import org.apache.accumulo.core.client.Accumulo;
 import org.apache.accumulo.core.client.AccumuloClient;
@@ -87,7 +86,8 @@ import org.apache.accumulo.core.security.SystemPermission;
 import org.apache.accumulo.core.security.TablePermission;
 import org.apache.accumulo.core.trace.TraceUtil;
 import org.apache.accumulo.core.util.FastFormat;
-import org.apache.accumulo.harness.AccumuloClusterHarness;
+import org.apache.accumulo.harness.MiniClusterConfigurationCallback;
+import org.apache.accumulo.harness.SharedMiniClusterBase;
 import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl;
 import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
 import org.apache.accumulo.test.constraints.AlphaNumKeyConstraint;
@@ -100,15 +100,16 @@ import org.apache.hadoop.io.Text;
 import org.apache.htrace.Sampler;
 import org.apache.htrace.Trace;
 import org.apache.htrace.TraceScope;
-import org.junit.Assume;
+import org.junit.AfterClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.Iterables;
 
-public class ConditionalWriterIT extends AccumuloClusterHarness {
+public class ConditionalWriterIT extends SharedMiniClusterBase {
   private static final Logger log = LoggerFactory.getLogger(ConditionalWriterIT.class);
 
   @Override
@@ -116,13 +117,24 @@ public class ConditionalWriterIT extends AccumuloClusterHarness {
     return 60;
   }
 
-  @Override
-  public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite)
{
-    super.configureMiniCluster(cfg, hadoopCoreSite);
-    // Set the min span to 0 so we will definitely get all the traces back. See ACCUMULO-4365
-    Map<String,String> siteConf = cfg.getSiteConfig();
-    siteConf.put(Property.TRACE_SPAN_RECEIVER_PREFIX.getKey() + "tracer.span.min.ms", "0");
-    cfg.setSiteConfig(siteConf);
+  @BeforeClass
+  public static void setup() throws Exception {
+    SharedMiniClusterBase.startMiniClusterWithConfig(new Callback());
+  }
+
+  @AfterClass
+  public static void teardown() {
+    SharedMiniClusterBase.stopMiniCluster();
+  }
+
+  private static class Callback implements MiniClusterConfigurationCallback {
+    @Override
+    public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration coreSite)
{
+      // Set the min span to 0 so we will definitely get all the traces back. See ACCUMULO-4365
+      Map<String,String> siteConf = cfg.getSiteConfig();
+      siteConf.put(Property.TRACE_SPAN_RECEIVER_PREFIX.getKey() + "tracer.span.min.ms", "0");
+      cfg.setSiteConfig(siteConf);
+    }
   }
 
   public static long abs(long l) {
@@ -1527,11 +1539,9 @@ public class ConditionalWriterIT extends AccumuloClusterHarness {
   @Test
   public void testTrace() throws Exception {
     // Need to add a getClientConfig() to AccumuloCluster
-    Assume.assumeTrue(getClusterType() == ClusterType.MINI);
     Process tracer = null;
     try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
-      AccumuloCluster cluster = getCluster();
-      MiniAccumuloClusterImpl mac = (MiniAccumuloClusterImpl) cluster;
+      MiniAccumuloClusterImpl mac = getCluster();
       if (!client.tableOperations().exists("trace")) {
         tracer = mac.exec(TraceServer.class).getProcess();
         while (!client.tableOperations().exists("trace")) {
diff --git a/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
index 2aa4a76..fe7da74 100644
--- a/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
@@ -75,26 +75,36 @@ import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.NamespacePermission;
 import org.apache.accumulo.core.security.SystemPermission;
 import org.apache.accumulo.core.security.TablePermission;
-import org.apache.accumulo.harness.AccumuloClusterHarness;
+import org.apache.accumulo.harness.SharedMiniClusterBase;
 import org.apache.accumulo.test.categories.MiniClusterOnlyTests;
 import org.apache.accumulo.test.constraints.NumericValueConstraint;
 import org.apache.hadoop.io.Text;
 import org.junit.After;
-import org.junit.Assume;
+import org.junit.AfterClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 /**
- * Testing default namespace configuration with inheritance requires altering the system
state and
- * restoring it back to normal. Punt on this for now and just let it use a minicluster.
+ * Test different namespace permissions
  */
 @Category(MiniClusterOnlyTests.class)
-public class NamespacesIT extends AccumuloClusterHarness {
+public class NamespacesIT extends SharedMiniClusterBase {
 
   private AccumuloClient c;
   private String namespace;
 
+  @BeforeClass
+  public static void setup() throws Exception {
+    SharedMiniClusterBase.startMiniCluster();
+  }
+
+  @AfterClass
+  public static void teardown() {
+    SharedMiniClusterBase.stopMiniCluster();
+  }
+
   @Override
   public int defaultTimeoutSeconds() {
     return 60;
@@ -102,8 +112,6 @@ public class NamespacesIT extends AccumuloClusterHarness {
 
   @Before
   public void setupConnectorAndNamespace() {
-    Assume.assumeTrue(getClusterType() == ClusterType.MINI);
-
     // prepare a unique namespace and get a new root client for each test
     c = Accumulo.newClient().from(getClientProps()).build();
     namespace = "ns_" + getUniqueNames(1)[0];
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkLoadIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkLoadIT.java
index 2c4bfd4..7911e09 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkLoadIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkLoadIT.java
@@ -58,7 +58,8 @@ import org.apache.accumulo.core.file.rfile.RFile;
 import org.apache.accumulo.core.metadata.schema.TabletMetadata;
 import org.apache.accumulo.core.metadata.schema.TabletsMetadata;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.harness.AccumuloClusterHarness;
+import org.apache.accumulo.harness.MiniClusterConfigurationCallback;
+import org.apache.accumulo.harness.SharedMiniClusterBase;
 import org.apache.accumulo.minicluster.MemoryUnit;
 import org.apache.accumulo.minicluster.ServerType;
 import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
@@ -69,7 +70,9 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.RawLocalFileSystem;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.io.Text;
+import org.junit.AfterClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 import com.google.common.collect.ImmutableMap;
@@ -83,14 +86,26 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
  *
  * @since 2.0
  */
-public class BulkLoadIT extends AccumuloClusterHarness {
+public class BulkLoadIT extends SharedMiniClusterBase {
 
-  @Override
-  public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration conf) {
-    cfg.setMemory(ServerType.TABLET_SERVER, 128 * 4, MemoryUnit.MEGABYTE);
+  @BeforeClass
+  public static void setup() throws Exception {
+    SharedMiniClusterBase.startMiniClusterWithConfig(new Callback());
+  }
+
+  @AfterClass
+  public static void teardown() {
+    SharedMiniClusterBase.stopMiniCluster();
+  }
+
+  private static class Callback implements MiniClusterConfigurationCallback {
+    @Override
+    public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration conf) {
+      cfg.setMemory(ServerType.TABLET_SERVER, 128 * 4, MemoryUnit.MEGABYTE);
 
-    // use raw local file system
-    conf.set("fs.file.impl", RawLocalFileSystem.class.getName());
+      // use raw local file system
+      conf.set("fs.file.impl", RawLocalFileSystem.class.getName());
+    }
   }
 
   @Override
@@ -110,7 +125,7 @@ public class BulkLoadIT extends AccumuloClusterHarness {
       c.tableOperations().create(tableName);
       aconf = getCluster().getServerContext().getConfiguration();
       fs = getCluster().getFileSystem();
-      rootPath = cluster.getTemporaryPath().toString();
+      rootPath = getCluster().getTemporaryPath().toString();
     }
   }
 


Mime
View raw message