HDFS-11158. Ozone: TestDatanodeStateMachine is failing intermittently. Contributed by Weiwei Yang.

This commit is contained in:
Anu Engineer 2017-03-07 10:02:16 -08:00 committed by Owen O'Malley
parent 753979865b
commit 02fb9aed32
1 changed files with 4 additions and 15 deletions

View File

@ -118,23 +118,12 @@ public class TestDatanodeStateMachine {
@Test @Test
public void testDatanodeStateMachineStartThread() throws IOException, public void testDatanodeStateMachineStartThread() throws IOException,
InterruptedException, TimeoutException { InterruptedException, TimeoutException {
final DatanodeStateMachine stateMachine = new DatanodeStateMachine(conf); DatanodeStateMachine stateMachine =
Runnable startStateMachineTask = () -> { DatanodeStateMachine.initStateMachine(conf);
try {
stateMachine.start();
} catch (Exception ex) {
}
};
Thread thread1 = new Thread(startStateMachineTask);
thread1.setDaemon(true);
thread1.start();
SCMConnectionManager connectionManager = SCMConnectionManager connectionManager =
stateMachine.getConnectionManager(); stateMachine.getConnectionManager();
GenericTestUtils.waitFor(() -> connectionManager.getValues().size() == 3,
GenericTestUtils.waitFor(() -> connectionManager.getValues().size() == 3 , 1000, 30000);
100, 1000);
stateMachine.close(); stateMachine.close();
} }