From commits-return-22535-archive-asf-public=cust-asf.ponee.io@accumulo.apache.org Sun Jan 27 15:08:58 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id C3CB2180600 for ; Sun, 27 Jan 2019 15:08:57 +0100 (CET) Received: (qmail 67122 invoked by uid 500); 27 Jan 2019 14:08:56 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 67113 invoked by uid 99); 27 Jan 2019 14:08:56 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Jan 2019 14:08:56 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 475C8855AC; Sun, 27 Jan 2019 14:08:56 +0000 (UTC) Date: Sun, 27 Jan 2019 14:08:56 +0000 To: "commits@accumulo.apache.org" Subject: [accumulo] branch master updated: Fixes several ITs that are broken (#921) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <154859813585.16332.1295207360911062889@gitbox.apache.org> From: mwalch@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: accumulo X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 43626decef4577e1f38d281a94aa91eab4848852 X-Git-Newrev: e26532a022574551f8c76869e8eb9f878b524a5a X-Git-Rev: e26532a022574551f8c76869e8eb9f878b524a5a X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. mwalch pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/accumulo.git The following commit(s) were added to refs/heads/master by this push: new e26532a Fixes several ITs that are broken (#921) e26532a is described below commit e26532a022574551f8c76869e8eb9f878b524a5a Author: Mike Walch AuthorDate: Sun Jan 27 09:08:51 2019 -0500 Fixes several ITs that are broken (#921) * Hadoop config cannot be pulled from ServerContext if it has it has been constructed yet * Remove usages of scanner after it has been closed --- .../miniclusterImpl/MiniAccumuloClusterImpl.java | 2 +- .../apache/accumulo/test/ScanFlushWithTimeIT.java | 6 +--- .../accumulo/test/functional/ConcurrencyIT.java | 37 ++++++++++------------ .../org/apache/accumulo/test/functional/SslIT.java | 4 +-- .../test/functional/SslWithClientAuthIT.java | 4 +-- .../test/functional/WriteAheadLogEncryptedIT.java | 2 +- 6 files changed, 21 insertions(+), 34 deletions(-) diff --git a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java index db402f2..5037f35 100644 --- a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java +++ b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java @@ -408,7 +408,7 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster { siteConfig.put(Property.INSTANCE_DFS_DIR.getKey(), "/accumulo"); config.setSiteConfig(siteConfig); } else if (config.useExistingInstance()) { - dfsUri = getServerContext().getHadoopConf().get(CommonConfigurationKeys.FS_DEFAULT_NAME_KEY); + dfsUri = config.getHadoopConfiguration().get(CommonConfigurationKeys.FS_DEFAULT_NAME_KEY); } else { dfsUri = "file:///"; } diff --git a/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java b/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java index deff587..c31246e 100644 --- a/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java @@ -94,11 +94,7 @@ public class ScanFlushWithTimeIT extends AccumuloClusterHarness { private void testScanner(ScannerBase s, long expected) { long now = System.currentTimeMillis(); - try { - s.iterator().next(); - } finally { - s.close(); - } + s.iterator().next(); long diff = System.currentTimeMillis() - now; log.info("Diff = {}", diff); assertTrue("Scanner taking too long to return intermediate results: " + diff, diff < expected); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyIT.java index 20afa56..50613a9 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyIT.java @@ -24,14 +24,10 @@ import java.util.Map; import java.util.concurrent.TimeUnit; import org.apache.accumulo.core.client.AccumuloClient; -import org.apache.accumulo.core.client.AccumuloException; -import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.IteratorSetting; -import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.Scanner; -import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Mutation; @@ -51,26 +47,27 @@ public class ConcurrencyIT extends AccumuloClusterHarness { static class ScanTask extends Thread { int count = 0; - Scanner scanner = null; + AccumuloClient client; + String tableName; + long time; + + ScanTask(AccumuloClient client, String tableName, long time) { + this.client = client; + this.tableName = tableName; + this.time = time; + } - ScanTask(AccumuloClient client, String tableName, long time) throws Exception { - try { - scanner = client.createScanner(tableName, Authorizations.EMPTY); + @Override + public void run() { + try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) { IteratorSetting slow = new IteratorSetting(30, "slow", SlowIterator.class); SlowIterator.setSleepTime(slow, time); scanner.addScanIterator(slow); - } finally { - if (scanner != null) { - scanner.close(); - } + count = Iterators.size(scanner.iterator()); + } catch (TableNotFoundException e) { + throw new IllegalStateException(e); } } - - @Override - public void run() { - count = Iterators.size(scanner.iterator()); - } - } @Override @@ -103,9 +100,7 @@ public class ConcurrencyIT extends AccumuloClusterHarness { } } - static void runTest(AccumuloClient c, String tableName) - throws AccumuloException, AccumuloSecurityException, TableExistsException, - TableNotFoundException, MutationsRejectedException, Exception, InterruptedException { + static void runTest(AccumuloClient c, String tableName) throws Exception { c.tableOperations().create(tableName); IteratorSetting is = new IteratorSetting(10, SlowIterator.class); SlowIterator.setSleepTime(is, 50); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SslIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SslIT.java index d07265a..aa17e75 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/SslIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/SslIT.java @@ -17,8 +17,6 @@ package org.apache.accumulo.test.functional; import org.apache.accumulo.core.client.AccumuloClient; -import org.apache.accumulo.core.client.AccumuloException; -import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; @@ -43,7 +41,7 @@ public class SslIT extends ConfigurableMacBase { } @Test - public void binary() throws AccumuloException, AccumuloSecurityException, Exception { + public void binary() throws Exception { try (AccumuloClient client = createClient()) { String tableName = getUniqueNames(1)[0]; client.tableOperations().create(tableName); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java index 8c893c0..844aded 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java @@ -18,8 +18,6 @@ package org.apache.accumulo.test.functional; import java.util.Map; -import org.apache.accumulo.core.client.AccumuloException; -import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl; import org.apache.hadoop.conf.Configuration; @@ -46,7 +44,7 @@ public class SslWithClientAuthIT extends SslIT { @Override @Test - public void binary() throws AccumuloException, AccumuloSecurityException, Exception { + public void binary() throws Exception { super.binary(); } diff --git a/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogEncryptedIT.java b/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogEncryptedIT.java index ab6bdaf..19b7121 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogEncryptedIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogEncryptedIT.java @@ -48,7 +48,7 @@ public class WriteAheadLogEncryptedIT extends AccumuloClusterHarness { // setup key file try { Path keyFile = new Path(keyPath); - FileSystem fs = FileSystem.getLocal(cluster.getServerContext().getHadoopConf()); + FileSystem fs = FileSystem.getLocal(new Configuration()); fs.delete(keyFile, true); if (fs.createNewFile(keyFile)) log.info("Created keyfile at {}", keyPath);