You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/01/03 18:46:24 UTC
git commit: ACCUMULO-2102 Fix for intermittent failures of
ShellSetInstanceTest by Bill Havanki
Updated Branches:
refs/heads/1.6.0-SNAPSHOT a573f96d4 -> 2654ba56f
ACCUMULO-2102 Fix for intermittent failures of ShellSetInstanceTest by Bill Havanki
I think the problem may lie in the use of SiteConfiguration by the Shell. It only creates a single static
instance object during the run, so after the first time it is used in a unit test, subsequent unit tests
should receive the same object with an old mock inside, instead of a new one with a new mock.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/2654ba56
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/2654ba56
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/2654ba56
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 2654ba56f4e1a040839493096005a25f0c4925fd
Parents: a573f96
Author: Josh Elser <el...@apache.org>
Authored: Fri Jan 3 12:45:01 2014 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Fri Jan 3 12:45:01 2014 -0500
----------------------------------------------------------------------
.../java/org/apache/accumulo/core/conf/SiteConfiguration.java | 7 +++++++
.../apache/accumulo/core/util/shell/ShellSetInstanceTest.java | 6 ++++++
2 files changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/2654ba56/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
index 8f1f72a..4c7d95e 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
@@ -81,6 +81,13 @@ public class SiteConfiguration extends AccumuloConfiguration {
/**
* method here to support testing, do not call
*/
+ synchronized public static void clearInstance() {
+ instance = null;
+ }
+
+ /**
+ * method here to support testing, do not call
+ */
public void clear() {
getXmlConfig().clear();
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/2654ba56/core/src/test/java/org/apache/accumulo/core/util/shell/ShellSetInstanceTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/util/shell/ShellSetInstanceTest.java b/core/src/test/java/org/apache/accumulo/core/util/shell/ShellSetInstanceTest.java
index a2769bd..40b5cf0 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/shell/ShellSetInstanceTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/shell/ShellSetInstanceTest.java
@@ -42,10 +42,12 @@ import org.apache.accumulo.core.client.mock.MockInstance;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.ConfigSanityCheck;
import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.conf.SiteConfiguration;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.hadoop.fs.Path;
import org.apache.log4j.Level;
import org.easymock.EasyMock;
+import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -95,6 +97,10 @@ public class ShellSetInstanceTest {
shell = new Shell(new ConsoleReader(new FileInputStream(FileDescriptor.in), output));
shell.setLogErrorsToConsole();
}
+ @After
+ public void tearDown() {
+ SiteConfiguration.clearInstance();
+ }
@Test
public void testSetInstance_Fake() throws Exception {