diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/DummyHAService.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/DummyHAService.java index 3173310032..62a381bd21 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/DummyHAService.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/DummyHAService.java @@ -37,6 +37,7 @@ */ class DummyHAService extends HAServiceTarget { public static final Log LOG = LogFactory.getLog(DummyHAService.class); + private static final String DUMMY_FENCE_KEY = "dummy.fence.key"; volatile HAServiceState state; HAServiceProtocol proxy; NodeFencer fencer; @@ -55,8 +56,9 @@ class DummyHAService extends HAServiceTarget { this.proxy = makeMock(); try { Configuration conf = new Configuration(); - this.fencer = Mockito.spy(NodeFencer.create(conf, - DummyFencer.class.getName())); + conf.set(DUMMY_FENCE_KEY, DummyFencer.class.getName()); + this.fencer = Mockito.spy( + NodeFencer.create(conf, DUMMY_FENCE_KEY)); } catch (BadFencingConfigurationException e) { throw new RuntimeException(e); }