accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1501497 [1/2] - in /accumulo/trunk: core/src/main/java/org/apache/accumulo/core/cli/ minicluster/src/main/java/org/apache/accumulo/minicluster/ server/src/main/java/org/apache/accumulo/server/tabletserver/ test/src/main/java/org/apache/acc...
Date Tue, 09 Jul 2013 19:50:08 GMT
Author: ecn
Date: Tue Jul  9 19:50:06 2013
New Revision: 1501497

URL: http://svn.apache.org/r1501497
Log:
ACCUMULO-1537 completed the conversion of functional tests to IT; also converted ShellServerTest to an IT

Added:
    accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/ProcessNotFoundException.java   (with props)
    accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/ProcessReference.java   (with props)
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java   (with props)
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java   (with props)
    accumulo/trunk/test/src/test/c/
    accumulo/trunk/test/src/test/c/fake_disk_failure.c
      - copied, changed from r1500885, accumulo/trunk/test/system/auto/fake_disk_failure.c
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
      - copied, changed from r1500885, accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java   (with props)
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/LateLastContactIT.java   (with props)
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MetadataSplitIT.java   (with props)
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/NativeMapIT.java   (with props)
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java   (with props)
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RestartStressIT.java   (with props)
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/WriteAheadLogIT.java   (with props)
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ZooCacheIT.java   (with props)
Removed:
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
    accumulo/trunk/test/system/auto/fake_disk_failure.c
    accumulo/trunk/test/system/auto/simple/masterFailover.py
    accumulo/trunk/test/system/auto/simple/nativeMap.py
    accumulo/trunk/test/system/auto/simple/shell.py
    accumulo/trunk/test/system/auto/simple/splitRecovery.py
    accumulo/trunk/test/system/auto/simple/wal.py
    accumulo/trunk/test/system/auto/simple/zoo.py
    accumulo/trunk/test/system/auto/simple/zooCacheTest.py
    accumulo/trunk/test/system/auto/stress/halfDead.py
    accumulo/trunk/test/system/auto/stress/migrations.py
    accumulo/trunk/test/system/auto/stress/msplit.py
    accumulo/trunk/test/system/auto/stress/restart.py
    accumulo/trunk/test/system/auto/stress/table.py
    accumulo/trunk/test/system/auto/stress/weird.py
Modified:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java
    accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/CacheTestClean.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/NativeMapTest.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BinaryIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BloomFilterIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BulkIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ChaoticBlancerIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DeleteIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MacTest.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MapReduceIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MaxOpenIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TimeoutIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/VisibilityIT.java

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java Tue Jul  9 19:50:06 2013
@@ -31,7 +31,7 @@ public class ClientOnDefaultTable extend
   }
   
   @Parameter(names = "--table", description = "table to use")
-  String tableName;
+  public String tableName;
   
   public String getTableName() {
     if (tableName == null)

Modified: accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java (original)
+++ accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java Tue Jul  9 19:50:06 2013
@@ -25,9 +25,12 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
@@ -39,6 +42,7 @@ import org.apache.accumulo.core.client.I
 import org.apache.accumulo.core.client.ZooKeeperInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.master.thrift.MasterGoalState;
+import org.apache.accumulo.core.util.Daemon;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.server.master.Master;
@@ -48,6 +52,7 @@ import org.apache.accumulo.server.util.I
 import org.apache.accumulo.server.util.PortUtils;
 import org.apache.accumulo.server.util.time.SimpleTimer;
 import org.apache.accumulo.start.Main;
+import org.apache.commons.io.FileUtils;
 import org.apache.zookeeper.server.ZooKeeperServerMain;
 
 /**
@@ -58,7 +63,7 @@ import org.apache.zookeeper.server.ZooKe
  */
 public class MiniAccumuloCluster {
   
-  public static class LogWriter extends Thread {
+  public static class LogWriter extends Daemon {
     private BufferedReader in;
     private BufferedWriter out;
 
@@ -66,7 +71,6 @@ public class MiniAccumuloCluster {
      * @throws IOException
      */
     public LogWriter(InputStream stream, File logFile) throws IOException {
-      this.setDaemon(true);
       this.in = new BufferedReader(new InputStreamReader(stream));
       out = new BufferedWriter(new FileWriter(logFile));
 
@@ -108,9 +112,9 @@ public class MiniAccumuloCluster {
   }
 
   private boolean initialized = false;
-  private Process zooKeeperProcess;
-  private Process masterProcess;
-  private Process[] tabletServerProcesses;
+  private Process zooKeeperProcess = null;
+  private Process masterProcess = null;
+  private List<Process> tabletServerProcesses = new ArrayList<Process>();
 
   private Set<Pair<ServerType,Integer>> debugPorts = new HashSet<Pair<ServerType,Integer>>();
 
@@ -140,6 +144,7 @@ public class MiniAccumuloCluster {
 
     ArrayList<String> argList = new ArrayList<String>();
     argList.addAll(Arrays.asList(javaBin, "-cp", classpath));
+    argList.add("-Djava.library.path=" + config.getLibDir());
     argList.addAll(extraJvmOpts);
     argList.addAll(Arrays.asList("-XX:+UseConcMarkSweepGC", "-XX:CMSInitiatingOccupancyFraction=75", Main.class.getName(), className));
     argList.addAll(Arrays.asList(args));
@@ -236,6 +241,15 @@ public class MiniAccumuloCluster {
     zooCfg.store(fileWriter, null);
 
     fileWriter.close();
+
+    File nativeMap = new File(config.getLibDir().getAbsolutePath() + "/native/map");
+    nativeMap.mkdirs();
+    String testRoot = new File(new File(System.getProperty("user.dir")).getParent() + "/server/src/main/c++/nativeMap").getAbsolutePath();
+    for (String file : new File(testRoot).list()) {
+      File src = new File(testRoot, file);
+      if (src.isFile() && file.startsWith("libNativeMap"))
+        FileUtils.copyFile(src, new File(nativeMap, file));
+    }
   }
 
   /**
@@ -247,8 +261,6 @@ public class MiniAccumuloCluster {
    *           if already started
    */
   public void start() throws IOException, InterruptedException {
-    if (zooKeeperProcess != null)
-      throw new IllegalStateException("Already started");
 
     if (!initialized) {
       
@@ -265,12 +277,13 @@ public class MiniAccumuloCluster {
         }
       });
     }
-      
-    zooKeeperProcess = exec(Main.class, ServerType.ZOOKEEPER, ZooKeeperServerMain.class.getName(), zooCfgFile.getAbsolutePath());
 
-    // sleep a little bit to let zookeeper come up before calling init, seems to work better
-    UtilWaitThread.sleep(250);
-    
+    if (zooKeeperProcess == null) {
+      zooKeeperProcess = exec(Main.class, ServerType.ZOOKEEPER, ZooKeeperServerMain.class.getName(), zooCfgFile.getAbsolutePath());
+      // sleep a little bit to let zookeeper come up before calling init, seems to work better
+      UtilWaitThread.sleep(250);
+    }
+
     if (!initialized) {
       Process initProcess = exec(Initialize.class, "--instance-name", config.getInstanceName(), "--password", config.getRootPassword(), "--username", "root");
       int ret = initProcess.waitFor();
@@ -280,17 +293,17 @@ public class MiniAccumuloCluster {
       initialized = true; 
     }
 
-    tabletServerProcesses = new Process[config.getNumTservers()];
-    for (int i = 0; i < config.getNumTservers(); i++) {
-      tabletServerProcesses[i] = exec(TabletServer.class, ServerType.TABLET_SERVER);
+    for (int i = tabletServerProcesses.size(); i < config.getNumTservers(); i++) {
+      tabletServerProcesses.add(exec(TabletServer.class, ServerType.TABLET_SERVER));
     }
     Process goal = exec(Main.class, SetGoalState.class.getName(), MasterGoalState.NORMAL.toString());
     int ret = goal.waitFor();
     if (ret != 0) {
       throw new RuntimeException("Could not set master goal state, process returned " + ret);
     }
-
-    masterProcess = exec(Master.class, ServerType.MASTER);
+    if (masterProcess == null) {
+      masterProcess = exec(Master.class, ServerType.MASTER);
+    }
   }
 
   private List<String> buildRemoteDebugParams(int port) {
@@ -305,6 +318,53 @@ public class MiniAccumuloCluster {
   public Set<Pair<ServerType,Integer>> getDebugPorts() {
     return debugPorts;
   }
+  
+  List<ProcessReference> references(Process... procs) {
+    List<ProcessReference> result = new ArrayList<ProcessReference>();
+    for (Process proc : procs) {
+      result.add(new ProcessReference(proc));
+    }
+    return result;
+  }
+  
+  public Map<ServerType, Collection<ProcessReference>> getProcesses() {
+    Map<ServerType, Collection<ProcessReference>> result = new HashMap<ServerType, Collection<ProcessReference>>();
+    result.put(ServerType.MASTER, references(masterProcess));
+    result.put(ServerType.TABLET_SERVER, references(tabletServerProcesses.toArray(new Process[0])));
+    result.put(ServerType.ZOOKEEPER, references(zooKeeperProcess));
+    return result;
+  }
+  
+  public void killProcess(ServerType type, ProcessReference proc) throws ProcessNotFoundException {
+    boolean found = false;
+    switch (type) {
+      case MASTER:
+        if (proc.equals(masterProcess)) {
+          masterProcess.destroy();
+          masterProcess = null;
+          found = true;
+        }
+        break;
+      case TABLET_SERVER:
+        for (Process tserver: tabletServerProcesses) {
+          if (proc.equals(tserver)) {
+            tabletServerProcesses.remove(tserver);
+            found = true;
+            break;
+          }
+        }
+        break;
+      case ZOOKEEPER:
+        if (proc.equals(zooKeeperProcess)) {
+          zooKeeperProcess.destroy();
+          zooKeeperProcess = null;
+          found = true;
+        }
+        break;
+    }
+    if (!found)
+      throw new ProcessNotFoundException();
+  }
 
   /**
    * @return Accumulo instance name
@@ -342,7 +402,7 @@ public class MiniAccumuloCluster {
       lw.flush();
     zooKeeperProcess = null;
     masterProcess = null;
-    tabletServerProcesses = null;
+    tabletServerProcesses.clear();
   }
 
   /**

Added: accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/ProcessNotFoundException.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/ProcessNotFoundException.java?rev=1501497&view=auto
==============================================================================
--- accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/ProcessNotFoundException.java (added)
+++ accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/ProcessNotFoundException.java Tue Jul  9 19:50:06 2013
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.minicluster;
+
+public class ProcessNotFoundException extends Exception {
+
+  private static final long serialVersionUID = 1L;
+  
+}

Propchange: accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/ProcessNotFoundException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/ProcessReference.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/ProcessReference.java?rev=1501497&view=auto
==============================================================================
--- accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/ProcessReference.java (added)
+++ accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/ProcessReference.java Tue Jul  9 19:50:06 2013
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.accumulo.minicluster;
+
+/**
+ * Opaque handle to a process.
+ */
+public class ProcessReference {
+  private Process process;
+
+  ProcessReference(Process process) {
+    this.process = process;
+  }
+  
+  @Override
+  public String toString() {
+    return process.toString();
+  }
+  
+  @Override
+  public int hashCode() {
+    return process.hashCode();
+  }
+  
+  @Override
+  public boolean equals(Object obj) {
+    return process.equals(obj);
+  }
+}

Propchange: accumulo/trunk/minicluster/src/main/java/org/apache/accumulo/minicluster/ProcessReference.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java Tue Jul  9 19:50:06 2013
@@ -204,6 +204,7 @@ import org.apache.accumulo.trace.instrum
 import org.apache.accumulo.trace.instrument.thrift.TraceWrap;
 import org.apache.accumulo.trace.thrift.TInfo;
 import org.apache.commons.collections.map.LRUMap;
+import org.apache.hadoop.fs.FSError;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;
@@ -1550,6 +1551,8 @@ public class TabletServer extends Abstra
             break;
           } catch (IOException ex) {
             log.warn("logging mutations failed, retrying");
+          } catch (FSError ex) { // happens when DFS is localFS
+            log.warn("logging mutations failed, retrying");
           } catch (Throwable t) {
             log.error("Unknown exception logging mutations, counts for mutations in flight not decremented!", t);
             throw new RuntimeException(t);

Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java Tue Jul  9 19:50:06 2013
@@ -150,7 +150,7 @@ public class VerifyIngest {
         
         Key startKey = new Key(new Text("row_" + String.format("%010d", expectedRow)));
         
-        Scanner scanner = connector.createScanner("test_ingest", labelAuths);
+        Scanner scanner = connector.createScanner(opts.getTableName(), labelAuths);
         scanner.setBatchSize(scanOpts.scanBatchSize);
         scanner.setRange(new Range(startKey, endKey));
         for (int j = 0; j < opts.cols; j++) {

Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/CacheTestClean.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/CacheTestClean.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/CacheTestClean.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/CacheTestClean.java Tue Jul  9 19:50:06 2013
@@ -17,11 +17,11 @@
 package org.apache.accumulo.test.functional;
 
 import java.io.File;
-import java.util.Arrays;
 
 import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
+import org.apache.commons.io.FileUtils;
 
 public class CacheTestClean {
   
@@ -38,14 +38,9 @@ public class CacheTestClean {
       zoo.recursiveDelete(rootDir, NodeMissingPolicy.FAIL);
     }
     
-    if (!reportDir.exists()) {
-      reportDir.mkdir();
-    } else {
-      File[] files = reportDir.listFiles();
-      if (files.length != 0)
-        throw new Exception("dir " + reportDir + " is not empty: " + Arrays.asList(files));
+    if (reportDir.exists()) {
+      FileUtils.deleteDirectory(reportDir);
     }
-    
+    reportDir.mkdirs();
   }
-  
 }

Added: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java?rev=1501497&view=auto
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java (added)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java Tue Jul  9 19:50:06 2013
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.functional;
+
+import java.util.Collections;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.accumulo.minicluster.ProcessReference;
+import org.apache.accumulo.minicluster.ServerType;
+import org.apache.accumulo.server.master.Master;
+import org.apache.accumulo.test.TestIngest;
+import org.apache.accumulo.test.VerifyIngest;
+import org.junit.Test;
+
+public class MasterFailoverIT extends MacTest {
+  
+  @Override
+  public void configure(MiniAccumuloConfig cfg) {
+    cfg.setSiteConfig(Collections.singletonMap(Property.INSTANCE_ZK_TIMEOUT.getKey(), "5s"));
+  }
+
+  @Test(timeout=30*1000)
+  public void test() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("test_ingest");
+    TestIngest.Opts opts = new TestIngest.Opts();
+    TestIngest.ingest(c, opts, BWOPTS);
+    for (ProcessReference master : cluster.getProcesses().get(ServerType.MASTER)) {
+      cluster.killProcess(ServerType.MASTER, master);
+    }
+    // start up a new one
+    Process p = cluster.exec(Master.class);
+    // talk to it
+    c.tableOperations().rename("test_ingest", "test_ingest2");
+    try {
+      VerifyIngest.Opts vopts = new VerifyIngest.Opts();
+      vopts.tableName = "test_ingest2";
+      VerifyIngest.verifyIngest(c, vopts, SOPTS);
+    } finally {
+      p.destroy();
+    }
+  }
+}

Propchange: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/NativeMapTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/NativeMapTest.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/NativeMapTest.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/NativeMapTest.java Tue Jul  9 19:50:06 2013
@@ -86,6 +86,7 @@ public class NativeMapTest {
     nmt.testBinary();
     nmt.testEmpty();
     nmt.testConcurrentIter();
+    System.out.println("Ran to completion");
   }
   
   // END JUnit methods

Added: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java?rev=1501497&view=auto
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java (added)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java Tue Jul  9 19:50:06 2013
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.functional;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class SplitRecoveryIT extends MacTest {
+  
+  @Test(timeout=10*1000)
+  public void test() throws Exception {
+    assertEquals(0, cluster.exec(SplitRecoveryTest.class).waitFor());
+  }
+  
+}

Propchange: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: accumulo/trunk/test/src/test/c/fake_disk_failure.c (from r1500885, accumulo/trunk/test/system/auto/fake_disk_failure.c)
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/c/fake_disk_failure.c?p2=accumulo/trunk/test/src/test/c/fake_disk_failure.c&p1=accumulo/trunk/test/system/auto/fake_disk_failure.c&r1=1500885&r2=1501497&rev=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/system/auto/fake_disk_failure.c (original)
+++ accumulo/trunk/test/src/test/c/fake_disk_failure.c Tue Jul  9 19:50:06 2013
@@ -25,16 +25,12 @@ void test_pause() {
   static char trickFile[1024] = "";
   static char pid[10] = "";
   if (trickFile[0] == '\0') {
-    strcpy(trickFile, getenv("HOME"));
-    strcat(trickFile, "/");
-    strcat(trickFile, "HOLD_IO_");
-    sprintf(pid, "%d", getpid());
-    strcat(trickFile, pid);
+    strcpy(trickFile, getenv("TRICK_FILE"));
   }
 
   while (access(trickFile, R_OK) == 0) {
-    fprintf(stderr, "sleeping\n");
-    fflush(stderr);
+    fprintf(stdout, "sleeping\n");
+    fflush(stdout);
     sleep(1);
   }
 }

Copied: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java (from r1500885, accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java)
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java?p2=accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java&p1=accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java&r1=1500885&r2=1501497&rev=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java Tue Jul  9 19:50:06 2013
@@ -40,6 +40,8 @@ import org.apache.accumulo.core.data.Key
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.file.FileOperations;
 import org.apache.accumulo.core.file.FileSKVWriter;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.core.util.shell.Shell;
@@ -52,12 +54,13 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.tools.DistCp;
+import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
-public class ShellServerTest {
+public class ShellServerIT {
   public static class TestOutputStream extends OutputStream {
     StringBuilder sb = new StringBuilder();
     
@@ -152,6 +155,7 @@ public class ShellServerTest {
     cluster = new MiniAccumuloCluster(cfg);
     cluster.start();
     
+    // history file is updated in $HOME
     System.setProperty("HOME", folder.getRoot().getAbsolutePath());
     
     // start the shell
@@ -180,7 +184,16 @@ public class ShellServerTest {
     folder.delete();
   }
   
-  @Test(timeout = 30000)
+  @After
+  public void tearDown() throws Exception {
+    Connector c = cluster.getConnector("root", secret);
+    for (String table : c.tableOperations().list()) {
+      if (!table.equals(MetadataTable.NAME) && !table.equals(RootTable.NAME))
+        c.tableOperations().delete(table);
+    }
+  }
+  
+  @Test(timeout = 30*1000)
   public void exporttableImporttable() throws Exception {
     // exporttable / importtable
     exec("createtable t -evc", true);
@@ -222,7 +235,7 @@ public class ShellServerTest {
     throw new RuntimeException("Unexpected constructors for DistCp");
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void setscaniterDeletescaniter() throws Exception {
     // setscaniter, deletescaniter
     exec("createtable t");
@@ -238,7 +251,7 @@ public class ShellServerTest {
     
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void execfile() throws Exception {
     // execfile
     File file = folder.newFile();
@@ -249,7 +262,7 @@ public class ShellServerTest {
     
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void egrep() throws Exception {
     // egrep
     exec("createtable t");
@@ -259,7 +272,7 @@ public class ShellServerTest {
     exec("deletetable -f t");
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void du() throws Exception {
     // du
     exec("createtable t");
@@ -284,7 +297,7 @@ public class ShellServerTest {
     exec("debug debug debug", false);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void user() throws Exception {
     // createuser, deleteuser, user, users, droptable, grant, revoke
     input.set("secret\nsecret\n");
@@ -318,7 +331,7 @@ public class ShellServerTest {
     exec("users", true, "xyzzy", false);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void iter() throws Exception {
     // setshelliter, listshelliter, deleteshelliter
     exec("createtable t");
@@ -327,6 +340,8 @@ public class ShellServerTest {
     exec("insert a cf cq 1");
     input.set("true\n\n\nSTRING\n");
     exec("setshelliter -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 10 -pn sum -n name", true);
+    exec("setshelliter -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 11 -pn sum -n name", false);
+    exec("setshelliter -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 10 -pn sum -n other", false);
     input.set("true\n\n\nSTRING\n");
     exec("setshelliter -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 11 -pn sum -n xyzzy", true);
     exec("scan -pn sum", true, "3", true);
@@ -347,6 +362,8 @@ public class ShellServerTest {
     exec("insert a cf cq 1");
     input.set("true\n\n\nSTRING\n");
     exec("setiter -scan -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 10 -n name", true);
+    exec("setiter -scan -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 11 -n name", false);
+    exec("setiter -scan -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 10 -n other", false);
     input.set("true\n\n\nSTRING\n");
     exec("setiter -scan -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 11 -n xyzzy", true);
     exec("scan", true, "3", true);
@@ -361,7 +378,7 @@ public class ShellServerTest {
     
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void notable() throws Exception {
     // notable
     exec("createtable xyzzy", true);
@@ -373,7 +390,7 @@ public class ShellServerTest {
     exec("deletetable -f xyzzy");
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void sleep() throws Exception {
     // sleep
     long now = System.currentTimeMillis();
@@ -383,7 +400,7 @@ public class ShellServerTest {
     assertTrue(diff < 400);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void addauths() throws Exception {
     // addauths
     exec("createtable xyzzy -evc");
@@ -397,7 +414,7 @@ public class ShellServerTest {
     exec("deletetable -f xyzzy");
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void byeQuitExit() throws Exception {
     // bye, quit, exit
     for (String cmd : "bye quit exit".split(" ")) {
@@ -408,13 +425,13 @@ public class ShellServerTest {
     }
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void classpath() throws Exception {
     // classpath
     exec("classpath", true, "Level 2: Java Classloader (loads everything defined by java classpath) URL classpath items are", true);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void clearCls() throws Exception {
     // clear/cls
     if (shell.getReader().getTerminal().isAnsiSupported()) {
@@ -426,7 +443,7 @@ public class ShellServerTest {
     }
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void clonetable() throws Exception {
     // clonetable
     exec("createtable orig -evc");
@@ -471,7 +488,7 @@ public class ShellServerTest {
     exec("deletetable -f c");
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void constraint() throws Exception {
     // constraint
     exec("constraint -l -t !METADATA", true, "MetadataConstraints=1", true);
@@ -482,7 +499,7 @@ public class ShellServerTest {
     exec("deletetable -f c");
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void deletemany() throws Exception {
     // deletemany
     exec("createtable t");
@@ -509,7 +526,7 @@ public class ShellServerTest {
     exec("deletetable -f t");
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void deleterows() throws Exception {
     // deleterows
     int base = countFiles();
@@ -523,7 +540,7 @@ public class ShellServerTest {
     exec("deletetable -f t");
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void groups() throws Exception {
     exec("createtable t");
     exec("setgroups -t t alpha=a,b,c num=3,2,1");
@@ -532,7 +549,7 @@ public class ShellServerTest {
     exec("deletetable -f t");
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void grep() throws Exception {
     exec("createtable t", true);
     make10();
@@ -542,7 +559,7 @@ public class ShellServerTest {
   }
   
   @Test
-  // (timeout = 30000)
+  // (timeout = 30 * 1000)
   public void help() throws Exception {
     exec("help -np", true, "Help Commands", true);
     exec("?", true, "Help Commands", true);
@@ -555,7 +572,7 @@ public class ShellServerTest {
     }
   }
   
-  // @Test(timeout = 30000)
+  // @Test(timeout = 30 * 1000)
   public void history() throws Exception {
     exec("history -c", true);
     exec("createtable unusualstring");
@@ -564,7 +581,7 @@ public class ShellServerTest {
     exec("history", true, "history", true);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void importDirectory() throws Exception {
     Configuration conf = new Configuration();
     FileSystem fs = FileSystem.get(conf);
@@ -590,6 +607,7 @@ public class ShellServerTest {
     }
     evenWriter.close();
     oddWriter.close();
+    assertEquals(0, shell.getExitCode());
     exec("createtable t", true);
     exec("importdirectory " + importDir + " " + errorsDir + " true", true);
     exec("scan -r 00000000", true, "00000000", true);
@@ -597,12 +615,12 @@ public class ShellServerTest {
     exec("deletetable -f t");
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void info() throws Exception {
     exec("info", true, Constants.VERSION, true);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void interpreter() throws Exception {
     exec("createtable t", true);
     exec("interpreter -l", true, "HexScan", false);
@@ -614,7 +632,7 @@ public class ShellServerTest {
     exec("deletetable -f t", true);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void listcompactions() throws Exception {
     exec("createtable t", true);
     exec("config -t t -s table.iterator.minc.slow=30,org.apache.accumulo.test.functional.SlowIterator", true);
@@ -633,7 +651,7 @@ public class ShellServerTest {
     exec("deletetable -f t", true);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void maxrow() throws Exception {
     exec("createtable t", true);
     exec("insert a cf cq value", true);
@@ -646,7 +664,7 @@ public class ShellServerTest {
     exec("deletetable -f t", true);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void merge() throws Exception {
     exec("createtable t");
     exec("addsplits a m z");
@@ -663,7 +681,7 @@ public class ShellServerTest {
     assertEquals(1, output.get().split("\n").length);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void ping() throws Exception {
     for (int i = 0; i < 10; i++) {
       exec("ping", true, "OK", true);
@@ -676,7 +694,7 @@ public class ShellServerTest {
     assertEquals(3, output.get().split("\n").length);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void renametable() throws Exception {
     exec("createtable aaaa");
     exec("insert this is a value");
@@ -687,7 +705,7 @@ public class ShellServerTest {
     exec("deletetable -f xyzzy", true);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void systempermission() throws Exception {
     exec("systempermissions");
     assertEquals(8, output.get().split("\n").length - 1);
@@ -695,7 +713,7 @@ public class ShellServerTest {
     assertEquals(6, output.get().split("\n").length - 1);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void listscans() throws Exception {
     exec("createtable t", true);
     exec("config -t t -s table.iterator.scan.slow=30,org.apache.accumulo.test.functional.SlowIterator", true);
@@ -730,7 +748,7 @@ public class ShellServerTest {
     exec("deletetable -f t", true);
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void testPertableClasspath() throws Exception {
     File fooFilterJar = File.createTempFile("FooFilter", ".jar");
     FileUtils.copyURLToFile(this.getClass().getResource("/FooFilter.jar"), fooFilterJar);
@@ -772,7 +790,7 @@ public class ShellServerTest {
     
   }
   
-  @Test(timeout = 30000)
+  @Test(timeout = 30 * 1000)
   public void trace() throws Exception {
     exec("trace on", true);
     exec("createtable t", true);
@@ -781,16 +799,58 @@ public class ShellServerTest {
     exec("deletetable -f t");
     exec("sleep 1");
     String trace = exec("trace off");
-    assertTrue(trace.contains("binMutations"));
-    assertTrue(trace.contains("update"));
+    System.out.println(trace);
+    assertTrue(trace.contains("sendMutations"));
+    assertTrue(trace.contains("startScan"));
     assertTrue(trace.contains("DeleteTable"));
   }
   
+  @Test(timeout=30 * 1000)
+  public void badLogin() throws Exception {
+    input.set(secret + "\n");
+    String err = exec("user NoSuchUser", false);
+    assertTrue(err.contains("BAD_CREDENTIALS for user NoSuchUser"));
+  }
+  
   private int countkeys(String table) throws IOException {
     exec("scan -np -t " + table);
     return output.get().split("\n").length - 1;
   }
   
+  @Test(timeout = 30 * 1000)
+  public void scans() throws Exception {
+    exec("createtable t");
+    make10();
+    String result = exec("scan -np -b row1 -e row1");
+    assertEquals(2, result.split("\n").length);
+    result = exec("scan -np -b row3 -e row5");
+    assertEquals(4, result.split("\n").length);
+    result = exec("scan -np -r row3");
+    assertEquals(2, result.split("\n").length);
+    result = exec("scan -np -b row:");
+    assertEquals(1, result.split("\n").length);
+    result = exec("scan -np -b row");
+    assertEquals(11, result.split("\n").length);
+    result = exec("scan -np -e row:");
+    assertEquals(11, result.split("\n").length);
+    exec("deletetable -f t");
+  }
+  
+  @Test(timeout = 30 * 1000)
+  public void whoami() throws Exception {
+    assertTrue(exec("whoami", true).contains("root"));
+    input.set("secret\nsecret\n");
+    exec("createuser test_user");
+    exec("setauths -u test_user -s 12,3,4");
+    String auths = exec("getauths -u test_user");
+    assertTrue(auths.contains("3") && auths.contains("12") && auths.contains("4"));
+    input.set("secret\n");
+    exec("user test_user", true);
+    assertTrue(exec("whoami", true).contains("test_user"));
+    input.set(secret + "\n");
+    exec("user root", true);
+  }
+  
   private void make10() throws IOException {
     for (int i = 0; i < 10; i++) {
       exec(String.format("insert row%d cf col%d value", i, i));

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java Tue Jul  9 19:50:06 2013
@@ -72,7 +72,7 @@ public class TableOperationsIT {
     connector = accumuloCluster.getConnector(ROOT, ROOT_PASS);
   }
   
-  @Test
+  @Test(timeout=30*1000)
   public void getDiskUsageErrors() throws TableExistsException, AccumuloException, AccumuloSecurityException, TableNotFoundException, TException {
     connector.tableOperations().create("table1");
     List<DiskUsage> diskUsage = connector.tableOperations().getDiskUsage(Collections.singleton("table1"));
@@ -93,7 +93,7 @@ public class TableOperationsIT {
     } catch (TableNotFoundException e) {}
   }
   
-  @Test
+  @Test(timeout=30*1000)
   public void getDiskUsage() throws TableExistsException, AccumuloException, AccumuloSecurityException, TableNotFoundException, TException {
     
     connector.tableOperations().create("table1");
@@ -148,7 +148,7 @@ public class TableOperationsIT {
     connector.tableOperations().delete("table1");
   }
   
-  @Test
+  @Test(timeout=30*1000)
   public void createTable() throws TableExistsException, AccumuloException, AccumuloSecurityException, TableNotFoundException {
     connector.tableOperations().create("table1");
     Iterable<Map.Entry<String,String>> itrProps = connector.tableOperations().getProperties("table1");

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BinaryIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BinaryIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BinaryIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BinaryIT.java Tue Jul  9 19:50:06 2013
@@ -28,7 +28,7 @@ import org.junit.Test;
 
 public class BinaryIT extends MacTest {
   
-  @Test
+  @Test(timeout=30*1000)
   public void test() throws Exception {
     Connector c = getConnector();
     c.tableOperations().create("bt");

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BloomFilterIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BloomFilterIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BloomFilterIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BloomFilterIT.java Tue Jul  9 19:50:06 2013
@@ -49,15 +49,15 @@ public class BloomFilterIT extends MacTe
     cfg.setDefaultMemory(500, MemoryUnit.MEGABYTE);
   }
   
-  @Test(timeout=500*1000)
+  @Test(timeout=200*1000)
   public void test() throws Exception {
     Connector c = getConnector();
     for (String table : "bt1 bt2 bt3 bt4".split(" ")) {
       c.tableOperations().create(table);
     }
-    write(c, "bt1", 1, 0, 1000000000, 100);
-    write(c, "bt2", 2, 0, 1000000000, 100);
-    write(c, "bt3", 3, 0, 1000000000, 100);
+    write(c, "bt1", 1, 0, 1000000000, 250);
+    write(c, "bt2", 2, 0, 1000000000, 250);
+    write(c, "bt3", 3, 0, 1000000000, 250);
     
     // test inserting an empty key
     BatchWriter bw = c.createBatchWriter("bt4", new BatchWriterConfig());
@@ -80,9 +80,9 @@ public class BloomFilterIT extends MacTe
     FunctionalTestUtils.checkRFiles(c, "bt4", 1, 1, 1, 1);
     
     // these queries should only run quickly if bloom filters are working, so lets get a base
-    long t1 = query(c, "bt1", 1, 0, 1000000000, 100000, 100);
-    long t2 = query(c, "bt2", 2, 0, 1000000000, 100000, 100);
-    long t3 = query(c, "bt3", 3, 0, 1000000000, 100000, 100);
+    long t1 = query(c, "bt1", 1, 0, 1000000000, 100000, 250);
+    long t2 = query(c, "bt2", 2, 0, 1000000000, 100000, 250);
+    long t3 = query(c, "bt3", 3, 0, 1000000000, 100000, 250);
     
     c.tableOperations().setProperty("bt1", Property.TABLE_BLOOM_ENABLED.getKey(), "true");
     c.tableOperations().setProperty("bt1", Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(), RowFunctor.class.getName());
@@ -102,9 +102,9 @@ public class BloomFilterIT extends MacTe
     
     // these queries should only run quickly if bloom
     // filters are working
-    long tb1 = query(c, "bt1", 1, 0, 1000000000, 100000, 100);
-    long tb2 = query(c, "bt2", 2, 0, 1000000000, 100000, 100);
-    long tb3 = query(c, "bt3", 3, 0, 1000000000, 100000, 100);
+    long tb1 = query(c, "bt1", 1, 0, 1000000000, 100000, 250);
+    long tb2 = query(c, "bt2", 2, 0, 1000000000, 100000, 250);
+    long tb3 = query(c, "bt3", 3, 0, 1000000000, 100000, 250);
     
     timeCheck(t1, tb1);
     timeCheck(t2, tb2);

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BulkIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BulkIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BulkIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BulkIT.java Tue Jul  9 19:50:06 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.accumulo.test.functional;
 
-import org.apache.accumulo.core.cli.BatchWriterOpts;
-import org.apache.accumulo.core.cli.ScannerOpts;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.test.TestIngest;
@@ -49,24 +47,24 @@ public class BulkIT extends MacTest {
     for (int i = 0; i < COUNT; i++) {
       opts.outputFile = base + String.format("/testrf/rf%02d", i);
       opts.startRow = N * i;
-      TestIngest.ingest(c, opts , new BatchWriterOpts());
+      TestIngest.ingest(c, opts , BWOPTS);
     }
     opts.outputFile = base + String.format("/testrf/rf%02d", N);
     opts.startRow = N;
     opts.rows = 1;
     // create an rfile with one entry, there was a bug with this:
-    TestIngest.ingest(c, opts , new BatchWriterOpts());
+    TestIngest.ingest(c, opts , BWOPTS);
     c.tableOperations().importDirectory("test_ingest", base + "/testrf", base + "/testBulkFail", false);
     VerifyIngest.Opts vopts = new VerifyIngest.Opts();
     vopts.random = 56;
     for (int i = 0; i < COUNT; i++) {
       vopts.startRow = i * N;
       vopts.rows = N;
-      VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+      VerifyIngest.verifyIngest(c, vopts, SOPTS);
     }
     vopts.startRow = N;
     vopts.rows = 1;
-    VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+    VerifyIngest.verifyIngest(c, vopts, SOPTS);
   }
   
   

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java Tue Jul  9 19:50:06 2013
@@ -19,7 +19,6 @@ package org.apache.accumulo.test.functio
 import java.util.Collections;
 
 import org.apache.accumulo.core.cli.ClientOpts.Password;
-import org.apache.accumulo.core.cli.ScannerOpts;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.util.CachedConfiguration;
@@ -83,7 +82,7 @@ public class BulkSplitOptimizationIT ext
     opts.startRow = 0;
     opts.cols = 1;
     opts.password = new Password(PASSWORD);
-    VerifyIngest.verifyIngest(c, opts, new ScannerOpts());
+    VerifyIngest.verifyIngest(c, opts, SOPTS);
     
     // ensure each tablet does not have all map files
     FunctionalTestUtils.checkRFiles(c, TABLE_NAME, 50, 100, 1, 4);

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ChaoticBlancerIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ChaoticBlancerIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ChaoticBlancerIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ChaoticBlancerIT.java Tue Jul  9 19:50:06 2013
@@ -21,8 +21,6 @@ import java.util.Map;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
-import org.apache.accumulo.core.cli.BatchWriterOpts;
-import org.apache.accumulo.core.cli.ScannerOpts;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.minicluster.MiniAccumuloConfig;
@@ -57,9 +55,9 @@ public class ChaoticBlancerIT extends Ma
     TestIngest.Opts opts = new TestIngest.Opts();
     VerifyIngest.Opts vopts = new VerifyIngest.Opts();
     vopts.rows = opts.rows = 200000;
-    TestIngest.ingest(c, opts, new BatchWriterOpts());
+    TestIngest.ingest(c, opts, BWOPTS);
     c.tableOperations().flush("test_ingest", null, null, true);
-    VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+    VerifyIngest.verifyIngest(c, vopts, SOPTS);
   }
   
 }

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DeleteIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DeleteIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DeleteIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DeleteIT.java Tue Jul  9 19:50:06 2013
@@ -18,7 +18,6 @@ package org.apache.accumulo.test.functio
 
 import static org.junit.Assert.assertEquals;
 
-import org.apache.accumulo.core.cli.BatchWriterOpts;
 import org.apache.accumulo.core.cli.ScannerOpts;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.server.util.Admin;
@@ -43,9 +42,9 @@ public class DeleteIT extends MacTest {
     vopts.rows = opts.rows = 1000;
     vopts.cols = opts.cols = 1;
     vopts.random = opts.random = 56;
-    TestIngest.ingest(c, opts, new BatchWriterOpts());
+    TestIngest.ingest(c, opts, BWOPTS);
     assertEquals(0, cluster.exec(TestRandomDeletes.class, "-p", MacTest.PASSWORD, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers()).waitFor());
-    TestIngest.ingest(c, opts, new BatchWriterOpts());
+    TestIngest.ingest(c, opts, BWOPTS);
     VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
   }
   

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java Tue Jul  9 19:50:06 2013
@@ -20,7 +20,6 @@ import static org.junit.Assert.assertTru
 
 import java.util.Collections;
 
-import org.apache.accumulo.core.cli.BatchWriterOpts;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.impl.MasterClient;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
@@ -41,23 +40,23 @@ public class DynamicThreadPoolsIT extend
   
   @Override
   public void configure(MiniAccumuloConfig cfg) {
-    cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "1"));
+    cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "100ms"));
   }
   
-  @Test(timeout = 90 * 1000)
+  @Test(timeout = 30 * 1000)
   public void test() throws Exception {
     Connector c = getConnector();
+    c.instanceOperations().setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), "1");
     TestIngest.Opts opts = new TestIngest.Opts();
-    opts.rows = 100000;
+    opts.rows = 100*1000;
     opts.createTable = true;
-    TestIngest.ingest(c, opts, new BatchWriterOpts());
+    TestIngest.ingest(c, opts, BWOPTS);
     c.tableOperations().flush("test_ingest", null, null, true);
     c.tableOperations().clone("test_ingest", "test_ingest2", true, null, null);
     c.tableOperations().clone("test_ingest", "test_ingest3", true, null, null);
     c.tableOperations().clone("test_ingest", "test_ingest4", true, null, null);
     c.tableOperations().clone("test_ingest", "test_ingest5", true, null, null);
     c.tableOperations().clone("test_ingest", "test_ingest6", true, null, null);
-    c.instanceOperations().setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), "1");
     
     TCredentials creds = CredentialHelper.create("root", new PasswordToken(MacTest.PASSWORD), c.getInstance().getInstanceName());
     UtilWaitThread.sleep(10);
@@ -79,6 +78,8 @@ public class DynamicThreadPoolsIT extend
           count += table.majors.running;
         }
       }
+      System.out.println("count " + count);
+      UtilWaitThread.sleep(1000);
     }
     assertTrue(count == 1 || count == 2); // sometimes we get two threads due to the way the stats are pulled
   }

Added: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java?rev=1501497&view=auto
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java (added)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java Tue Jul  9 19:50:06 2013
@@ -0,0 +1,158 @@
+package org.apache.accumulo.test.functional;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.util.Daemon;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.accumulo.minicluster.ServerType;
+import org.apache.accumulo.server.tabletserver.TabletServer;
+import org.apache.accumulo.start.Main;
+import org.apache.accumulo.test.TestIngest;
+import org.apache.accumulo.test.VerifyIngest;
+import org.junit.Test;
+
+public class HalfDeadTServerIT extends MacTest {
+  
+  @Override
+  public void configure(MiniAccumuloConfig cfg) {
+    cfg.setNumTservers(1);
+    Map<String,String> siteConfig = new HashMap<String,String>();
+    siteConfig.put(Property.INSTANCE_ZK_TIMEOUT.getKey(), "15s");
+    siteConfig.put(Property.GENERAL_RPC_TIMEOUT.getKey(), "5s");
+    cfg.setSiteConfig(siteConfig );
+  }
+  
+  class DumpOutput extends Daemon {
+    
+    private final BufferedReader rdr;
+    private final StringBuilder output;
+    
+    DumpOutput(InputStream is) {
+      rdr = new BufferedReader(new InputStreamReader(is));
+      output = new StringBuilder();
+    }
+    @Override
+    public void run() {
+      try {
+        while (true) {
+          String line = rdr.readLine();
+          if (line == null)
+            break;
+          System.out.println(line);
+          output.append(line);
+          output.append("\n");
+        }
+      } catch (IOException ex) {
+        log.error(ex, ex);
+      }
+    }
+    
+    @Override
+    public String toString() {
+      return output.toString();
+    }
+  }
+  
+  
+  @Test(timeout=30*1000)
+  public void testRecover() throws Exception {
+    test(10);
+  }
+  
+  @Test(timeout=60*1000)
+  public void testTimeout() throws Exception {
+    String results = test(40);
+    if (results != null)
+      assertTrue(results.contains("Session expired"));
+  }
+  
+  public String test(int seconds) throws Exception {
+    if (!makeDiskFailureLibrary())
+      return null;
+    Connector c = getConnector();
+    assertEquals(1, c.instanceOperations().getTabletServers().size());
+    // don't need the regular tablet server
+    cluster.killProcess(ServerType.TABLET_SERVER, cluster.getProcesses().get(ServerType.TABLET_SERVER).iterator().next());
+    
+    // create our own tablet server with the special test library
+    String javaHome = System.getProperty("java.home");
+    String javaBin = javaHome + File.separator + "bin" + File.separator + "java";
+    String classpath = System.getProperty("java.class.path");
+    classpath = new File(cluster.getConfig().getDir(), "conf") + File.pathSeparator + classpath;
+    String className = TabletServer.class.getCanonicalName();
+    ArrayList<String> argList = new ArrayList<String>();
+    argList.addAll(Arrays.asList(javaBin, "-cp", classpath));
+    argList.addAll(Arrays.asList(Main.class.getName(), className));
+    ProcessBuilder builder = new ProcessBuilder(argList);
+    Map<String,String> env = builder.environment();
+    env.put("ACCUMULO_HOME", cluster.getConfig().getDir().getAbsolutePath());
+    env.put("ACCUMULO_LOG_DIR", cluster.getConfig().getLogDir().getAbsolutePath());
+    String trickFilename = cluster.getConfig().getLogDir().getAbsolutePath() + "/TRICK_FILE";
+    env.put("TRICK_FILE", trickFilename);
+    String libPath = System.getProperty("user.dir") + "/target/fake_disk_failure.so";
+    env.put("LD_PRELOAD", libPath);
+    env.put("DYLD_INSERT_LIBRARIES", libPath);
+    env.put("DYLD_FORCE_FLAT_NAMESPACE", "true");
+    Process tserver = builder.start();
+    DumpOutput t = new DumpOutput(tserver.getInputStream());
+    t.start();
+    c.tableOperations().create("test_ingest");
+    assertTrue(c.instanceOperations().getTabletServers().size() > 1);
+    int rows = 100*1000;
+    Process ingest = cluster.exec(TestIngest.class, "-u", "root", "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", MacTest.PASSWORD, "--rows", rows + "");
+    UtilWaitThread.sleep(500);
+    
+    // block I/O with some side-channel trickiness
+    File trickFile = new File(trickFilename);
+    trickFile.createNewFile();
+    UtilWaitThread.sleep(seconds*1000);
+    trickFile.delete();
+
+    if (seconds <= 10) {
+      assertEquals(0, ingest.waitFor());
+      VerifyIngest.Opts vopts = new VerifyIngest.Opts();
+      vopts.rows = rows;
+      VerifyIngest.verifyIngest(c, vopts, SOPTS);
+    } else {
+      UtilWaitThread.sleep(5*1000);
+    }
+    // verify the process was blocked 
+    String results = t.toString();
+    assertTrue(results.contains("sleeping\nsleeping\nsleeping\n"));
+    assertTrue(results.contains("Zookeeper error, will retry"));
+    ingest.destroy();
+    tserver.destroy();
+    t.join();
+    return results;
+  }
+
+  private boolean makeDiskFailureLibrary() throws Exception {
+    String root = System.getProperty("user.dir");
+    String source = root + "/src/test/c/fake_disk_failure.c";
+    String lib = root + "/target/fake_disk_failure.so";
+    String platform = System.getProperty("os.name");
+    String cmd[];
+    if (platform.equals("Darwin")) {
+      cmd = new String[]{"gcc","-arch","x86_64","-arch","i386","-dynamiclib","-O3","-fPIC", source,"-o",lib};
+    } else {
+      cmd = new String[]{"gcc","-D_GNU_SOURCE","-Wall","-fPIC", source,"-shared", "-o", lib, "-ldl"};
+    }
+    Process gcc = Runtime.getRuntime().exec(cmd);
+    return gcc.waitFor() == 0;
+  }
+  
+}

Propchange: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/LateLastContactIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/LateLastContactIT.java?rev=1501497&view=auto
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/LateLastContactIT.java (added)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/LateLastContactIT.java Tue Jul  9 19:50:06 2013
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.functional;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Collections;
+
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.junit.Test;
+
+/**
+ * Fake the "tablet stops talking but holds its lock" problem we see when hard drives and NFS fail. 
+ * Start a ZombieTServer, and see that master stops it.
+ */
+public class LateLastContactIT extends MacTest {
+  
+  @Override
+  public void configure(MiniAccumuloConfig cfg) {
+    cfg.setSiteConfig(Collections.singletonMap(Property.GENERAL_RPC_TIMEOUT.getKey(), "2s"));
+  }
+
+  @Test
+  public void test() throws Exception {
+    Process zombie = cluster.exec(ZombieTServer.class);
+    assertEquals(0, zombie.waitFor());
+  }
+  
+}

Propchange: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/LateLastContactIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MacTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MacTest.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MacTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MacTest.java Tue Jul  9 19:50:06 2013
@@ -16,10 +16,13 @@
  */
 package org.apache.accumulo.test.functional;
 
+import org.apache.accumulo.core.cli.BatchWriterOpts;
+import org.apache.accumulo.core.cli.ScannerOpts;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.minicluster.MiniAccumuloCluster;
+import org.apache.accumulo.minicluster.MiniAccumuloCluster.LogWriter;
 import org.apache.accumulo.minicluster.MiniAccumuloConfig;
 import org.apache.log4j.Logger;
 import org.junit.After;
@@ -31,6 +34,8 @@ public class MacTest {
   public static TemporaryFolder folder = new TemporaryFolder();
   public static MiniAccumuloCluster cluster;
   public static final String PASSWORD = "secret";
+  static final ScannerOpts SOPTS = new ScannerOpts();
+  static final BatchWriterOpts BWOPTS = new BatchWriterOpts();
   
   public Connector getConnector() throws AccumuloException, AccumuloSecurityException {
     return cluster.getConnector("root", PASSWORD);
@@ -50,7 +55,10 @@ public class MacTest {
   
   @After
   public void tearDown() throws Exception {
-    cluster.stop();
+    if (cluster != null)
+      cluster.stop();
+    for (LogWriter log : cluster.getLogWriters())
+      log.flush();
     folder.delete();
   }
   

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MapReduceIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MapReduceIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MapReduceIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MapReduceIT.java Tue Jul  9 19:50:06 2013
@@ -43,7 +43,7 @@ public class MapReduceIT extends MacTest
   static final String output_cq = "cq-MD4BASE64";
   static final String output_cfcq =  input_cf + ":" + output_cq;
   
-  @Test
+  @Test(timeout=30*1000)
   public void test() throws Exception {
     Connector c = getConnector();
     c.tableOperations().create(tablename);

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MaxOpenIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MaxOpenIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MaxOpenIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MaxOpenIT.java Tue Jul  9 19:50:06 2013
@@ -53,7 +53,7 @@ public class MaxOpenIT extends MacTest {
   private static final int NUM_TABLETS = 16;
   private static final int NUM_TO_INGEST = 10000;
   
-  @Test
+  @Test(timeout=30*1000)
   public void run() throws Exception {
     Connector c = getConnector();
     c.tableOperations().create("test_ingest");

Added: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MetadataSplitIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MetadataSplitIT.java?rev=1501497&view=auto
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MetadataSplitIT.java (added)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MetadataSplitIT.java Tue Jul  9 19:50:06 2013
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.functional;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collections;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.junit.Test;
+
+public class MetadataSplitIT extends MacTest {
+  
+  @Override
+  public void configure(MiniAccumuloConfig cfg) {
+    cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "100ms"));
+  }
+ 
+  @Test(timeout = 30 * 1000)
+  public void test() throws Exception {
+    Connector c = getConnector();
+    assertEquals(1, c.tableOperations().listSplits(MetadataTable.NAME).size());
+    c.tableOperations().setProperty(MetadataTable.NAME, Property.TABLE_SPLIT_THRESHOLD.getKey(), "500");
+    for (int i = 0; i < 10; i++) {
+      c.tableOperations().create("table" + i);
+      c.tableOperations().flush(MetadataTable.NAME, null, null, true);
+    }
+    UtilWaitThread.sleep(10*1000);
+    assertTrue(c.tableOperations().listSplits(MetadataTable.NAME).size() > 2);
+  }
+}
\ No newline at end of file

Propchange: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MetadataSplitIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/NativeMapIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/NativeMapIT.java?rev=1501497&view=auto
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/NativeMapIT.java (added)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/NativeMapIT.java Tue Jul  9 19:50:06 2013
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.functional;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class NativeMapIT extends MacTest {
+  
+  @Test
+  public void test() throws Exception {
+    assertEquals(0, cluster.exec(NativeMapTest.class).waitFor());
+  }
+  
+}

Propchange: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/NativeMapIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java Tue Jul  9 19:50:06 2013
@@ -284,7 +284,7 @@ public class PermissionsIT extends MacTe
   
   private static final String TEST_TABLE = "__TABLE_PERMISSION_TEST__";
   
-  @Test
+  @Test(timeout=30*1000)
   public void tablePermissionTest() throws Exception {
     // create the test user
     Connector c = getConnector();

Added: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java?rev=1501497&view=auto
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java (added)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java Tue Jul  9 19:50:06 2013
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.functional;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.cli.BatchWriterOpts;
+import org.apache.accumulo.core.cli.ScannerOpts;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.accumulo.minicluster.ProcessReference;
+import org.apache.accumulo.minicluster.ServerType;
+import org.apache.accumulo.server.util.Admin;
+import org.apache.accumulo.test.TestIngest;
+import org.apache.accumulo.test.VerifyIngest;
+import org.junit.Test;
+
+public class RestartIT extends MacTest {
+  @Override
+  public void configure(MiniAccumuloConfig cfg) {
+    cfg.setSiteConfig(Collections.singletonMap(Property.INSTANCE_ZK_TIMEOUT.getKey(), "5s"));
+  }
+
+  private static final ScannerOpts SOPTS = new ScannerOpts();
+  private static final VerifyIngest.Opts VOPTS = new VerifyIngest.Opts();
+  private static final BatchWriterOpts BWOPTS = new BatchWriterOpts();
+  
+  @Test
+  public void restartMaster() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("test_ingest");
+    Process ingest = cluster.exec(TestIngest.class, 
+        "-u", "root", "-p", MacTest.PASSWORD, 
+        "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers());
+    for (ProcessReference master : cluster.getProcesses().get(ServerType.MASTER)) {
+      cluster.killProcess(ServerType.MASTER, master);
+    }
+    cluster.start();
+    assertEquals(0, ingest.waitFor());
+    VerifyIngest.verifyIngest(c, VOPTS, SOPTS);
+    ingest.destroy();
+  }
+  
+  @Test
+  public void restartMasterRecovery() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("test_ingest");
+    TestIngest.Opts opts = new TestIngest.Opts();
+    TestIngest.ingest(c, opts, BWOPTS);
+    for (Entry<ServerType,Collection<ProcessReference>> entry : cluster.getProcesses().entrySet()) {
+      for (ProcessReference proc : entry.getValue()) {
+        cluster.killProcess(entry.getKey(), proc);
+      }
+    }
+    cluster.start();
+    UtilWaitThread.sleep(5);
+    for (ProcessReference master : cluster.getProcesses().get(ServerType.MASTER)) {
+      cluster.killProcess(ServerType.MASTER, master);
+    }
+    cluster.start();
+    VerifyIngest.verifyIngest(c, VOPTS, SOPTS);
+  }
+  
+  @Test
+  public void restartMasterSplit() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("test_ingest");
+    c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "5K");
+    Process ingest = cluster.exec(TestIngest.class, 
+        "-u", "root", "-p", MacTest.PASSWORD, 
+        "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers());
+    for (ProcessReference master : cluster.getProcesses().get(ServerType.MASTER)) {
+      cluster.killProcess(ServerType.MASTER, master);
+    }
+    cluster.start();
+    assertEquals(0, ingest.waitFor());
+    VerifyIngest.verifyIngest(c, VOPTS, SOPTS);
+    ingest.destroy();
+  }
+  
+  @Test
+  public void killedTabletServer() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("test_ingest");
+    TestIngest.Opts opts = new TestIngest.Opts();
+    TestIngest.ingest(c, opts, BWOPTS);
+    VerifyIngest.verifyIngest(c, VOPTS, SOPTS);
+    List<ProcessReference> procs = new ArrayList<ProcessReference>(cluster.getProcesses().get(ServerType.TABLET_SERVER));
+    for (ProcessReference tserver : procs) {
+      cluster.killProcess(ServerType.TABLET_SERVER, tserver);
+      cluster.start();
+      VerifyIngest.verifyIngest(c, VOPTS, SOPTS);
+    }
+  }
+
+  @Test
+  public void killedTabletServerDuringShutdown() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("test_ingest");
+    TestIngest.Opts opts = new TestIngest.Opts();
+    TestIngest.ingest(c, opts, BWOPTS);
+    List<ProcessReference> procs = new ArrayList<ProcessReference>(cluster.getProcesses().get(ServerType.TABLET_SERVER));
+    cluster.killProcess(ServerType.TABLET_SERVER, procs.get(0));
+    assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+  }
+  
+  @Test
+  public void shutdownDuringCompactingSplitting() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("test_ingest");
+    c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "5K");
+    c.tableOperations().setProperty(MetadataTable.NAME, Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
+    TestIngest.Opts opts = new TestIngest.Opts();
+    TestIngest.ingest(c, opts, BWOPTS);
+    c.tableOperations().flush("test_ingest", null, null, false);
+    VerifyIngest.verifyIngest(c, VOPTS, SOPTS);
+    assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+  }
+  
+  
+}

Propchange: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RestartStressIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RestartStressIT.java?rev=1501497&view=auto
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RestartStressIT.java (added)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RestartStressIT.java Tue Jul  9 19:50:06 2013
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.functional;
+
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.accumulo.core.cli.ScannerOpts;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.accumulo.minicluster.ServerType;
+import org.apache.accumulo.test.TestIngest;
+import org.apache.accumulo.test.VerifyIngest;
+import org.junit.Test;
+
+public class RestartStressIT extends MacTest {
+  
+  @Override
+  public void configure(MiniAccumuloConfig cfg) {
+    Map<String, String> opts = new HashMap<String, String>();
+    opts.put(Property.TSERV_MAXMEM.getKey(), "5K");
+    opts.put(Property.TSERV_MAJC_DELAY.getKey(), "100ms");
+    opts.put(Property.TSERV_WALOG_MAX_SIZE.getKey(), "50K");
+    cfg.setSiteConfig(opts);
+  }
+
+  private static final TestIngest.Opts IOPTS;
+  private static final VerifyIngest.Opts VOPTS;
+  static {
+    IOPTS = new TestIngest.Opts();
+    VOPTS = new VerifyIngest.Opts();
+    IOPTS.rows = VOPTS.rows = 100*1000;
+  }
+  private static final ScannerOpts SOPTS = new ScannerOpts();
+  
+  
+  @Test(timeout=120*1000)
+  public void test() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("test_ingest");
+    c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "5K");
+    Process ingest = cluster.exec(TestIngest.class, 
+        "-u", "root", "-p", MacTest.PASSWORD, 
+        "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), 
+        "--rows", "" + IOPTS.rows);
+    for (int i = 0; i < 5; i++) {
+      UtilWaitThread.sleep(10*1000);
+      cluster.killProcess(ServerType.TABLET_SERVER, cluster.getProcesses().get(ServerType.TABLET_SERVER).iterator().next());
+      cluster.start();
+    }
+    assertEquals(0, ingest.waitFor());
+    VerifyIngest.verifyIngest(c, VOPTS, SOPTS);
+  }
+  
+}

Propchange: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RestartStressIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java Tue Jul  9 19:50:06 2013
@@ -38,7 +38,7 @@ import org.junit.Test;
 
 public class ServerSideErrorIT extends MacTest {
   
-  @Test
+  @Test(timeout=60*1000)
   public void run() throws Exception {
     Connector c = getConnector();
     c.tableOperations().create("tt");

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java Tue Jul  9 19:50:06 2013
@@ -73,7 +73,6 @@ public class SparseColumnFamilyIT extend
       scanner.setBatchSize(3);
       scanner.fetchColumnFamily(new Text(String.format("%03d", 1)));
       
-      long t1 = System.currentTimeMillis();
       Iterator<Entry<Key,Value>> iter = scanner.iterator();
       if (iter.hasNext()) {
         Entry<Key,Value> entry = iter.next();
@@ -81,10 +80,6 @@ public class SparseColumnFamilyIT extend
           throw new Exception();
         }
       }
-      long t2 = System.currentTimeMillis();
-      
-      System.out.println("time " + (t2 - t1));
-      
     }
   }
   

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java?rev=1501497&r1=1501496&r2=1501497&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java Tue Jul  9 19:50:06 2013
@@ -103,7 +103,7 @@ public class SplitIT extends MacTest {
     c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
     DeleteIT.deleteTest(c);
     c.tableOperations().flush("test_ingest", null, null, true);
-    UtilWaitThread.sleep(5*1000);
+    UtilWaitThread.sleep(10*1000);
     assertTrue(c.tableOperations().listSplits("test_ingest").size() > 30);
   }
   



Mime
View raw message