/** * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2). * When all but the leader and one observer are shut down, the leader should * enter the 'looking' state, not stay in the 'leading' state. */ @Test public void testLEWithObserver() throws Exception { QuorumPeer leader = null; for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) { if (server.getServerState().equals( QuorumStats.Provider.FOLLOWING_STATE)) { server.shutdown(); assertTrue("Waiting for server down", ClientBase .waitForServerDown("127.0.0.1:" + server.getClientPort(), ClientBase.CONNECTION_TIMEOUT)); } else { assertNull("More than one leader found", leader); leader = server; } } assertTrue("Leader is not in Looking state", ClientBase .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT, QuorumStats.Provider.LOOKING_STATE)); }