You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/02/27 22:53:12 UTC

svn commit: r1450985 - in /accumulo/branches/1.5: core/src/main/java/org/apache/accumulo/core/util/shell/commands/ examples/simple/src/test/java/org/apache/accumulo/examples/simple/dirlist/ test/src/main/java/org/apache/accumulo/test/ test/src/main/jav...

Author: ecn
Date: Wed Feb 27 21:53:12 2013
New Revision: 1450985

URL: http://svn.apache.org/r1450985
Log:
ACCUMULO-1004 fixing functional tests

Modified:
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java
    accumulo/branches/1.5/examples/simple/src/test/java/org/apache/accumulo/examples/simple/dirlist/CountTest.java
    accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/TestIngest.java
    accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java
    accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java
    accumulo/branches/1.5/test/system/auto/TestUtils.py
    accumulo/branches/1.5/test/system/auto/simple/binary.py
    accumulo/branches/1.5/test/system/auto/simple/examples.py
    accumulo/branches/1.5/test/system/auto/simple/readwrite.py
    accumulo/branches/1.5/test/system/auto/stress/batchWrite.py

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java?rev=1450985&r1=1450984&r2=1450985&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java (original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java Wed Feb 27 21:53:12 2013
@@ -17,14 +17,12 @@
 package org.apache.accumulo.core.util.shell.commands;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.util.Map;
 import java.util.Set;
 
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.security.CredentialHelper;
-import org.apache.accumulo.core.security.thrift.Credential;
 import org.apache.accumulo.core.security.tokens.PasswordToken;
 import org.apache.accumulo.core.util.shell.Shell;
 import org.apache.accumulo.core.util.shell.Shell.Command;

Modified: accumulo/branches/1.5/examples/simple/src/test/java/org/apache/accumulo/examples/simple/dirlist/CountTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/examples/simple/src/test/java/org/apache/accumulo/examples/simple/dirlist/CountTest.java?rev=1450985&r1=1450984&r2=1450985&view=diff
==============================================================================
--- accumulo/branches/1.5/examples/simple/src/test/java/org/apache/accumulo/examples/simple/dirlist/CountTest.java (original)
+++ accumulo/branches/1.5/examples/simple/src/test/java/org/apache/accumulo/examples/simple/dirlist/CountTest.java Wed Feb 27 21:53:12 2013
@@ -72,6 +72,7 @@ public class CountTest extends TestCase 
     opts.tableName = "dirlisttable";
     opts.password = new Password("secret");
     opts.mock = true;
+    opts.password = new Opts.Password("");
     FileCount fc = new FileCount(opts, scanOpts, bwOpts);
     fc.run();
     

Modified: accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/TestIngest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/TestIngest.java?rev=1450985&r1=1450984&r2=1450985&view=diff
==============================================================================
--- accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/TestIngest.java (original)
+++ accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/TestIngest.java Wed Feb 27 21:53:12 2013
@@ -204,7 +204,6 @@ public class TestIngest {
       
       BatchWriter bw = null;
       FileSKVWriter writer = null;
-      Connector connector = opts.getConnector();
       
       if (opts.outputFile != null) {
         Configuration conf = CachedConfiguration.getInstance();
@@ -213,9 +212,10 @@ public class TestIngest {
             AccumuloConfiguration.getDefaultConfiguration());
         writer.startDefaultLocalityGroup();
       } else {
+        Connector connector = opts.getConnector();
         bw = connector.createBatchWriter(opts.getTableName(), bwOpts.getBatchWriterConfig());
+        connector.securityOperations().changeUserAuthorizations(opts.principal, AUTHS);
       }
-      connector.securityOperations().changeUserAuthorizations(opts.principal, AUTHS);
       Text labBA = new Text(opts.columnVisibility.getExpression());
       
       long startTime = System.currentTimeMillis();

Modified: accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java?rev=1450985&r1=1450984&r2=1450985&view=diff
==============================================================================
--- accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java (original)
+++ accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java Wed Feb 27 21:53:12 2013
@@ -71,19 +71,12 @@ public class VerifyIngest {
         Trace.currentTrace().data("cmdLine", Arrays.asList(args).toString());
       }
       
-      Connector connector = null;
-      while (connector == null) {
-        try {
-          connector = opts.getConnector();
-        } catch (AccumuloException e) {
-          log.warn("Could not connect to accumulo; will retry: " + e);
-          UtilWaitThread.sleep(1000);
-        }
-      }
+      Connector connector = opts.getConnector();
       
       byte[][] bytevals = TestIngest.generateValues(opts);
       
       Authorizations labelAuths = new Authorizations("L1", "L2", "G1", "GROUP2");
+      connector.securityOperations().changeUserAuthorizations(opts.principal, labelAuths);
       
       int expectedRow = opts.startRow;
       int expectedCol = 0;

Modified: accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java?rev=1450985&r1=1450984&r2=1450985&view=diff
==============================================================================
--- accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java (original)
+++ accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java Wed Feb 27 21:53:12 2013
@@ -21,6 +21,8 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.security.tokens.PasswordToken;
+import org.apache.accumulo.core.security.tokens.SecurityToken;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.test.CreateRFiles;
@@ -62,7 +64,7 @@ public class BulkSplitOptimizationTest e
     
     FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
     fs.delete(new Path("/tmp/testmf"), true);
-    
+    SecurityToken token = this.getToken();
     CreateRFiles.main(new String[] { "--output", "tmp/testmf", "--numThreads", "8", "--start", "0", "--end", "100000", "--splits", "99"});
     
     bulkImport(fs, TABLE_NAME, "/tmp/testmf");
@@ -82,7 +84,11 @@ public class BulkSplitOptimizationTest e
     
     checkSplits(TABLE_NAME, 50, 100);
     
-    VerifyIngest.main(new String[] {"--timestamp", "1", "--size", "50", "--random", "56", "--rows", "100000", "--start", "0", "--cols", "1"});
+    String passwd = "";
+    if (token instanceof PasswordToken) {
+      passwd = new String(((PasswordToken)token).getPassword());
+    }
+    VerifyIngest.main(new String[] {"--timestamp", "1", "--size", "50", "--random", "56", "--rows", "100000", "--start", "0", "--cols", "1", "-p", passwd});
     
     // ensure each tablet does not have all map files
     checkRFiles(TABLE_NAME, 50, 100, 1, 4);

Modified: accumulo/branches/1.5/test/system/auto/TestUtils.py
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/system/auto/TestUtils.py?rev=1450985&r1=1450984&r2=1450985&view=diff
==============================================================================
--- accumulo/branches/1.5/test/system/auto/TestUtils.py (original)
+++ accumulo/branches/1.5/test/system/auto/TestUtils.py Wed Feb 27 21:53:12 2013
@@ -120,7 +120,7 @@ class TestUtilsMixin:
             ld = 'ACCUMULO_LOG_DIR=%s/logs/%s' % (ACCUMULO_HOME, ID)
             execcmd = ['ssh', '-q', host, cp, jo, go, ld] + quote(cmd)
             log.debug(repr(execcmd))
-            return Popen(execcmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, **opts)
+            return Popen(execcmd, stdout=PIPE, stderr=PIPE, **opts)
             
     def shell(self, host, input, **opts):
         """Run accumulo shell with the given input,
@@ -220,7 +220,7 @@ class TestUtilsMixin:
         args = ''
         if timestamp:
             args += "-ts %ld " % int(timestamp)
-        args += '--debug -i %s -u %s --size %d --random 56 --rows %d --start %d --cols 1 --createTable -p secret' % (INSTANCE_NAME, ROOT, size, count, start)
+        args += '--debug -i %s -u %s --size %d --random 56 --rows %d --start %d --cols 1 --createTable -p %s' % (INSTANCE_NAME, ROOT, size, count, start, ROOT_PASSWORD)
         if colf:
            args = '--columnFamily %s ' % colf + args
         return self.runClassOn(host, klass, args.split(), **kwargs)
@@ -230,7 +230,7 @@ class TestUtilsMixin:
         args = ''
         if timestamp:
             args += "-ts %ld " % int(timestamp)
-        args += '-i %s -u %s --size %d --random 56 -cf %s --rows %d --start %d --cols 1 -p secret' % (INSTANCE_NAME, ROOT, size, colf, count, start)
+        args += '-i %s -u %s --size %d --random 56 -cf %s --rows %d --start %d --cols 1 -p %s' % (INSTANCE_NAME, ROOT, size, colf, count, start, ROOT_PASSWORD)
         return self.runClassOn(host, klass, args.split())
 
     def stop_accumulo(self, signal=signal.SIGHUP):

Modified: accumulo/branches/1.5/test/system/auto/simple/binary.py
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/system/auto/simple/binary.py?rev=1450985&r1=1450984&r2=1450985&view=diff
==============================================================================
--- accumulo/branches/1.5/test/system/auto/simple/binary.py (original)
+++ accumulo/branches/1.5/test/system/auto/simple/binary.py Wed Feb 27 21:53:12 2013
@@ -36,7 +36,7 @@ class BinaryTest(unittest.TestCase, Test
         handle = self.runClassOn(self.masterHost(), testClass, 
                                  ['-u', 'root',
                                   '--mode', mode, '-t', table, 
-                                  '--start', min, '--count', max])
+                                  '--start', min, '--count', max, '-p', 'secret'])
         self.waitForStop(handle, 200)
         
     def tearDown(self):

Modified: accumulo/branches/1.5/test/system/auto/simple/examples.py
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/system/auto/simple/examples.py?rev=1450985&r1=1450984&r2=1450985&view=diff
==============================================================================
--- accumulo/branches/1.5/test/system/auto/simple/examples.py (original)
+++ accumulo/branches/1.5/test/system/auto/simple/examples.py Wed Feb 27 21:53:12 2013
@@ -63,7 +63,7 @@ class Examples(TestUtilsMixin, unittest.
 	self.comment("Testing MaxMutation constraint")
 	self.ashell('createtable test_ingest\n'
                     'constraint -a org.apache.accumulo.examples.simple.constraints.MaxMutationSize\n')
-        handle = self.runOn('localhost', [self.accumulo_sh(), 'org.apache.accumulo.test.TestIngest', '-u', ROOT, '--rows', '1', '--start', '0', '--cols', '10000'])
+        handle = self.runOn('localhost', [self.accumulo_sh(), 'org.apache.accumulo.test.TestIngest', '-u', ROOT, '--rows', '1', '--start', '0', '--cols', '10000', '-p', ROOT_PASSWORD])
         out, err = handle.communicate()
         self.failIf(handle.returncode==0)
         self.failUnless(err.find("MutationsRejectedException: # constraint violations : 1") >= 0, "Was able to insert a mutation larger than max size")

Modified: accumulo/branches/1.5/test/system/auto/simple/readwrite.py
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/system/auto/simple/readwrite.py?rev=1450985&r1=1450984&r2=1450985&view=diff
==============================================================================
--- accumulo/branches/1.5/test/system/auto/simple/readwrite.py (original)
+++ accumulo/branches/1.5/test/system/auto/simple/readwrite.py Wed Feb 27 21:53:12 2013
@@ -20,7 +20,7 @@ import unittest
 import time
 import sys
 
-from TestUtils import TestUtilsMixin, FUZZ, ACCUMULO_HOME, SITE, INSTANCE_NAME
+from TestUtils import TestUtilsMixin, FUZZ, ACCUMULO_HOME, SITE, INSTANCE_NAME, ROOT, ROOT_PASSWORD
 
 log = logging.getLogger('test.auto')
 
@@ -82,12 +82,12 @@ class MultiTableTest(SunnyDayTest):
     
     def ingest(self, host, count, *args, **kwargs):
         klass = 'org.apache.accumulo.test.TestMultiTableIngest'
-        args = '--count %d -u root -i %s ' % (count, INSTANCE_NAME)
+        args = '--count %d -u root -i %s -p %s' % (count, INSTANCE_NAME, ROOT_PASSWORD)
         return self.runClassOn(host, klass, args.split())
 
     def verify(self, host, count, *args, **kwargs):
         klass = 'org.apache.accumulo.test.TestMultiTableIngest'
-        args = '--count %d --readonly -u root -i %s ' % (count, INSTANCE_NAME)
+        args = '--count %d --readonly -u root -i %s -p %s' % (count, INSTANCE_NAME, ROOT_PASSWORD)
         return self.runClassOn(host, klass, args.split())
 
 

Modified: accumulo/branches/1.5/test/system/auto/stress/batchWrite.py
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/system/auto/stress/batchWrite.py?rev=1450985&r1=1450984&r2=1450985&view=diff
==============================================================================
--- accumulo/branches/1.5/test/system/auto/stress/batchWrite.py (original)
+++ accumulo/branches/1.5/test/system/auto/stress/batchWrite.py Wed Feb 27 21:53:12 2013
@@ -19,7 +19,7 @@ import logging
 import unittest
 import time
 
-from TestUtils import TestUtilsMixin
+from TestUtils import TestUtilsMixin, ROOT_PASSWORD
 
 log = logging.getLogger('test.auto')
 
@@ -33,7 +33,7 @@ class WriteLots(unittest.TestCase, TestU
 
     def ingest(self, host, start, count, **kwargs):
         klass = 'org.apache.accumulo.test.TestIngest'
-        args = '--user root --size 50 --random 56 --rows %d --start %d --cols 1' % (count, start)
+        args = '--user root --size 50 --random 56 --rows %d --start %d --cols 1 -p %s' % (count, start, ROOT_PASSWORD)
         return self.runClassOn(host, klass, args.split(), **kwargs)
 
     def setUp(self):