|
@@ -41,6 +41,7 @@ import java.security.NoSuchAlgorithmException;
|
|
|
import java.util.concurrent.CyclicBarrier;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
|
+import static org.junit.Assert.assertEquals;
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
import static org.junit.Assert.fail;
|
|
|
|
|
@@ -203,7 +204,7 @@ public class TestZKRMStateStoreZKClientConnections extends
|
|
|
LOG.error(error, e);
|
|
|
fail(error);
|
|
|
}
|
|
|
- Assert.assertEquals("newBytes", new String(ret));
|
|
|
+ assertEquals("newBytes", new String(ret));
|
|
|
}
|
|
|
|
|
|
@Test(timeout = 20000)
|
|
@@ -232,7 +233,7 @@ public class TestZKRMStateStoreZKClientConnections extends
|
|
|
|
|
|
try {
|
|
|
byte[] ret = store.getDataWithRetries(path, false);
|
|
|
- Assert.assertEquals("bytes", new String(ret));
|
|
|
+ assertEquals("bytes", new String(ret));
|
|
|
} catch (Exception e) {
|
|
|
String error = "New session creation failed";
|
|
|
LOG.error(error, e);
|
|
@@ -281,4 +282,24 @@ public class TestZKRMStateStoreZKClientConnections extends
|
|
|
|
|
|
zkClientTester.getRMStateStore(conf);
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testZKRetryInterval() throws Exception {
|
|
|
+ TestZKClient zkClientTester = new TestZKClient();
|
|
|
+ YarnConfiguration conf = new YarnConfiguration();
|
|
|
+
|
|
|
+ ZKRMStateStore store =
|
|
|
+ (ZKRMStateStore) zkClientTester.getRMStateStore(conf);
|
|
|
+ assertEquals(YarnConfiguration.DEFAULT_RM_ZK_RETRY_INTERVAL_MS,
|
|
|
+ store.zkRetryInterval);
|
|
|
+ store.stop();
|
|
|
+
|
|
|
+ conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true);
|
|
|
+ store =
|
|
|
+ (ZKRMStateStore) zkClientTester.getRMStateStore(conf);
|
|
|
+ assertEquals(YarnConfiguration.DEFAULT_RM_ZK_TIMEOUT_MS /
|
|
|
+ YarnConfiguration.DEFAULT_ZK_RM_NUM_RETRIES,
|
|
|
+ store.zkRetryInterval);
|
|
|
+ store.stop();
|
|
|
+ }
|
|
|
}
|