Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6CAAF105C5 for ; Fri, 15 Nov 2013 19:48:27 +0000 (UTC) Received: (qmail 13335 invoked by uid 500); 15 Nov 2013 19:48:27 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 13250 invoked by uid 500); 15 Nov 2013 19:48:27 -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 13231 invoked by uid 99); 15 Nov 2013 19:48:27 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Nov 2013 19:48:27 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1159082F46C; Fri, 15 Nov 2013 19:48:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: elserj@apache.org To: commits@accumulo.apache.org Date: Fri, 15 Nov 2013 19:48:30 -0000 Message-Id: <16be6de50934433db5bfc4aa2dc742f1@git.apache.org> In-Reply-To: <2738e4ea447e436d9291900d670852be@git.apache.org> References: <2738e4ea447e436d9291900d670852be@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [5/5] git commit: Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT Conflicts: minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/0b8cca09 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/0b8cca09 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/0b8cca09 Branch: refs/heads/1.6.0-SNAPSHOT Commit: 0b8cca09ca6de47225762c28f8d77b7a76563947 Parents: 28bbb56 1261625 Author: Josh Elser Authored: Fri Nov 15 11:48:14 2013 -0800 Committer: Josh Elser Committed: Fri Nov 15 11:48:14 2013 -0800 ---------------------------------------------------------------------- .../simple/client/RandomBatchWriter.java | 1 + .../minicluster/MiniAccumuloClusterGCTest.java | 35 +++++++++++++++++--- 2 files changed, 31 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/0b8cca09/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java ---------------------------------------------------------------------- diff --cc minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java index 6470ce1,a1f58f6..281e805 --- a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java +++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java @@@ -33,54 -32,77 +33,79 @@@ import org.apache.commons.io.filefilter import org.apache.commons.io.filefilter.TrueFileFilter; import org.apache.log4j.Level; import org.apache.log4j.Logger; +import org.junit.AfterClass; import org.junit.Assert; +import org.junit.BeforeClass; + import org.junit.Ignore; import org.junit.Test; -import org.junit.rules.TemporaryFolder; import com.google.common.collect.ImmutableMap; + import com.google.common.io.Files; /** * */ public class MiniAccumuloClusterGCTest { + private static final Logger log = Logger.getLogger(MiniAccumuloClusterGCTest.class); + @Test + public void testGcConfig() throws Exception { + File f = Files.createTempDir(); + f.deleteOnExit(); + try { + MiniAccumuloConfig macConfig = new MiniAccumuloConfig(f, passwd); + macConfig.setNumTservers(1); + + Assert.assertEquals(false, macConfig.shouldRunGC()); + + // Turn on the garbage collector + macConfig.runGC(true); + + Assert.assertEquals(true, macConfig.shouldRunGC()); + } finally { + if (null != f && f.exists()) { + f.delete(); + } + } + } + + - private static TemporaryFolder tmpDir = new TemporaryFolder(); + private static File testDir = new File(System.getProperty("user.dir") + "/target/" + MiniAccumuloClusterGCTest.class.getName()); private static MiniAccumuloConfig macConfig; private static MiniAccumuloCluster accumulo; private static final String passwd = "password"; - + + @BeforeClass public static void setupMiniCluster() throws Exception { - tmpDir.create(); + FileUtils.deleteQuietly(testDir); + testDir.mkdir(); Logger.getLogger("org.apache.zookeeper").setLevel(Level.ERROR); - - macConfig = new MiniAccumuloConfig(tmpDir.getRoot(), passwd); + + macConfig = new MiniAccumuloConfig(testDir, passwd); macConfig.setNumTservers(1); - + // Turn on the garbage collector macConfig.runGC(true); - - String gcPort = Integer.toString(PortUtils.getRandomFreePort()); - + // And tweak the settings to make it run often - Map config = ImmutableMap.of(Property.GC_CYCLE_DELAY.getKey(), "1s", Property.GC_CYCLE_START.getKey(), "0s", Property.GC_PORT.getKey(), gcPort); + Map config = ImmutableMap.of(Property.GC_CYCLE_DELAY.getKey(), "1s", Property.GC_CYCLE_START.getKey(), "0s"); macConfig.setSiteConfig(config); - + accumulo = new MiniAccumuloCluster(macConfig); accumulo.start(); } - + + @AfterClass public static void tearDownMiniCluster() throws Exception { accumulo.stop(); - tmpDir.delete(); } - - @Test(timeout = 40 * 1000) - public void testFilesAreGarbageCollected() throws Exception { + + // This test seems to be a little too unstable for a unit test + @Ignore + public void test() throws Exception { ZooKeeperInstance inst = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()); Connector c = inst.getConnector("root", new PasswordToken(passwd)); - + final String table = "foobar"; c.tableOperations().create(table);