Author: mahadev Date: Thu Mar 4 22:55:36 2010 New Revision: 919226 URL: http://svn.apache.org/viewvc?rev=919226&view=rev Log: ZOOKEEPER-687. LENonterminatetest fails on some machines. (mahadev)
Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerMainTest.java hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/LENonTerminateTest.java hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ObserverTest.java Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=919226&r1=919225&r2=919226&view=diff ============================================================================== --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Thu Mar 4 22:55:36 2010 @@ -240,6 +240,8 @@ ZOOKEEPER-682. Event is not processed when the watcher is set to watch "/" if chrooted (Scott Wang via mahadev) + ZOOKEEPER-687. LENonterminatetest fails on some machines. (mahadev) + IMPROVEMENTS: ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to "socket reuse" and failure to close client (phunt via mahadev) Modified: hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerMainTest.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerMainTest.java?rev=919226&r1=919225&r2=919226&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerMainTest.java (original) +++ hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerMainTest.java Thu Mar 4 22:55:36 2010 @@ -106,11 +106,11 @@ main.start(); assertTrue("waiting for server being up", - ClientBase.waitForServerUp("localhost:" + CLIENT_PORT, + ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT, CONNECTION_TIMEOUT)); - ZooKeeper zk = new ZooKeeper("localhost:" + CLIENT_PORT, + ZooKeeper zk = new ZooKeeper("127.0.0.1:" + CLIENT_PORT, ClientBase.CONNECTION_TIMEOUT, this); zk.create("/foo", "foobar".getBytes(), Ids.OPEN_ACL_UNSAFE, @@ -121,7 +121,7 @@ main.shutdown(); assertTrue("waiting for server down", - ClientBase.waitForServerDown("localhost:" + CLIENT_PORT, + ClientBase.waitForServerDown("127.0.0.1:" + CLIENT_PORT, ClientBase.CONNECTION_TIMEOUT)); } Modified: hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java?rev=919226&r1=919225&r2=919226&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java (original) +++ hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java Thu Mar 4 22:55:36 2010 @@ -75,9 +75,9 @@ final int CLIENT_PORT_QP2 = PortAssignment.unique(); String quorumCfgSection = - "server.1=localhost:" + PortAssignment.unique() + "server.1=127.0.0.1:" + PortAssignment.unique() + ":" + PortAssignment.unique() - + "\nserver.2=localhost:" + PortAssignment.unique() + + "\nserver.2=127.0.0.1:" + PortAssignment.unique() + ":" + PortAssignment.unique(); MainThread q1 = new MainThread(1, CLIENT_PORT_QP1, quorumCfgSection); @@ -86,14 +86,14 @@ q2.start(); assertTrue("waiting for server 1 being up", - ClientBase.waitForServerUp("localhost:" + CLIENT_PORT_QP1, + ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT_QP1, CONNECTION_TIMEOUT)); assertTrue("waiting for server 2 being up", - ClientBase.waitForServerUp("localhost:" + CLIENT_PORT_QP2, + ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT_QP2, CONNECTION_TIMEOUT)); - ZooKeeper zk = new ZooKeeper("localhost:" + CLIENT_PORT_QP1, + ZooKeeper zk = new ZooKeeper("127.0.0.1:" + CLIENT_PORT_QP1, ClientBase.CONNECTION_TIMEOUT, this); zk.create("/foo_q1", "foobar1".getBytes(), Ids.OPEN_ACL_UNSAFE, @@ -101,7 +101,7 @@ assertEquals(new String(zk.getData("/foo_q1", null, null)), "foobar1"); zk.close(); - zk = new ZooKeeper("localhost:" + CLIENT_PORT_QP2, + zk = new ZooKeeper("127.0.0.1:" + CLIENT_PORT_QP2, ClientBase.CONNECTION_TIMEOUT, this); zk.create("/foo_q2", "foobar2".getBytes(), Ids.OPEN_ACL_UNSAFE, @@ -113,10 +113,10 @@ q2.shutdown(); assertTrue("waiting for server 1 down", - ClientBase.waitForServerDown("localhost:" + CLIENT_PORT_QP1, + ClientBase.waitForServerDown("127.0.0.1:" + CLIENT_PORT_QP1, ClientBase.CONNECTION_TIMEOUT)); assertTrue("waiting for server 2 down", - ClientBase.waitForServerDown("localhost:" + CLIENT_PORT_QP2, + ClientBase.waitForServerDown("127.0.0.1:" + CLIENT_PORT_QP2, ClientBase.CONNECTION_TIMEOUT)); } @@ -142,7 +142,7 @@ final int CLIENT_PORT_QP2 = PortAssignment.unique(); String quorumCfgSection = - "server.1=localhost:" + PortAssignment.unique() + "server.1=127.0.0.1:" + PortAssignment.unique() + ":" + PortAssignment.unique() + "\nserver.2=fee.fii.foo.fum:" + PortAssignment.unique() + ":" + PortAssignment.unique(); @@ -151,7 +151,7 @@ q1.start(); boolean isup = - ClientBase.waitForServerUp("localhost:" + CLIENT_PORT_QP1, + ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT_QP1, 5000); assertFalse("Server never came up", isup); @@ -159,7 +159,7 @@ q1.shutdown(); assertTrue("waiting for server 1 down", - ClientBase.waitForServerDown("localhost:" + CLIENT_PORT_QP1, + ClientBase.waitForServerDown("127.0.0.1:" + CLIENT_PORT_QP1, ClientBase.CONNECTION_TIMEOUT)); } finally { @@ -193,9 +193,9 @@ int electionPort1 = PortAssignment.unique(); int electionPort2 = PortAssignment.unique(); String quorumCfgSection = - "server.1=localhost:" + PortAssignment.unique() + "server.1=127.0.0.1:" + PortAssignment.unique() + ":" + electionPort1 - + "\nserver.2=localhost:" + PortAssignment.unique() + + "\nserver.2=127.0.0.1:" + PortAssignment.unique() + ":" + electionPort2; MainThread q1 = new MainThread(1, CLIENT_PORT_QP1, quorumCfgSection); @@ -204,10 +204,10 @@ q2.start(); assertTrue("waiting for server 1 being up", - ClientBase.waitForServerUp("localhost:" + CLIENT_PORT_QP1, + ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT_QP1, CONNECTION_TIMEOUT)); assertTrue("waiting for server 2 being up", - ClientBase.waitForServerUp("localhost:" + CLIENT_PORT_QP2, + ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT_QP2, CONNECTION_TIMEOUT)); byte[] b = new byte[4]; @@ -215,15 +215,15 @@ ByteBuffer buff = ByteBuffer.wrap(b); buff.putInt(length); buff.position(0); - SocketChannel s = SocketChannel.open(new InetSocketAddress("localhost", electionPort1)); + SocketChannel s = SocketChannel.open(new InetSocketAddress("127.0.0.1", electionPort1)); s.write(buff); s.close(); buff.position(0); - s = SocketChannel.open(new InetSocketAddress("localhost", electionPort2)); + s = SocketChannel.open(new InetSocketAddress("127.0.0.1", electionPort2)); s.write(buff); s.close(); - ZooKeeper zk = new ZooKeeper("localhost:" + CLIENT_PORT_QP1, + ZooKeeper zk = new ZooKeeper("127.0.0.1:" + CLIENT_PORT_QP1, ClientBase.CONNECTION_TIMEOUT, this); zk.create("/foo_q1", "foobar1".getBytes(), Ids.OPEN_ACL_UNSAFE, @@ -259,9 +259,9 @@ final int CLIENT_PORT_QP2 = PortAssignment.unique(); String quorumCfgSection = - "server.1=localhost:" + PortAssignment.unique() + "server.1=127.0.0.1:" + PortAssignment.unique() + ":" + PortAssignment.unique() - + "\nserver.2=localhost:" + PortAssignment.unique() + + "\nserver.2=127.0.0.1:" + PortAssignment.unique() + ":" + PortAssignment.unique(); MainThread q1 = new MainThread(1, CLIENT_PORT_QP1, quorumCfgSection); @@ -270,20 +270,20 @@ q2.start(); assertTrue("waiting for server 1 being up", - ClientBase.waitForServerUp("localhost:" + CLIENT_PORT_QP1, + ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT_QP1, CONNECTION_TIMEOUT)); assertTrue("waiting for server 2 being up", - ClientBase.waitForServerUp("localhost:" + CLIENT_PORT_QP2, + ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT_QP2, CONNECTION_TIMEOUT)); q1.shutdown(); q2.shutdown(); assertTrue("waiting for server 1 down", - ClientBase.waitForServerDown("localhost:" + CLIENT_PORT_QP1, + ClientBase.waitForServerDown("127.0.0.1:" + CLIENT_PORT_QP1, ClientBase.CONNECTION_TIMEOUT)); assertTrue("waiting for server 2 down", - ClientBase.waitForServerDown("localhost:" + CLIENT_PORT_QP2, + ClientBase.waitForServerDown("127.0.0.1:" + CLIENT_PORT_QP2, ClientBase.CONNECTION_TIMEOUT)); } finally { Modified: hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/LENonTerminateTest.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/LENonTerminateTest.java?rev=919226&r1=919225&r2=919226&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/LENonTerminateTest.java (original) +++ hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/LENonTerminateTest.java Thu Mar 4 22:55:36 2010 @@ -116,8 +116,8 @@ int clientport = PortAssignment.unique(); peers.put(Long.valueOf(i), new QuorumServer(i, - new InetSocketAddress(clientport), - new InetSocketAddress(PortAssignment.unique()))); + new InetSocketAddress("127.0.0.1", clientport), + new InetSocketAddress("127.0.0.1", PortAssignment.unique()))); tmpdir[i] = ClientBase.createTmpDir(); port[i] = clientport; } Modified: hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ObserverTest.java URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ObserverTest.java?rev=919226&r1=919225&r2=919226&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ObserverTest.java (original) +++ hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ObserverTest.java Thu Mar 4 22:55:36 2010 @@ -80,11 +80,11 @@ String quorumCfgSection = "electionAlg=3\n" + - "server.1=localhost:" + (PORT_QP1) + "server.1=127.0.0.1:" + (PORT_QP1) + ":" + (PORT_QP_LE1) - + "\nserver.2=localhost:" + (PORT_QP2) + + "\nserver.2=127.0.0.1:" + (PORT_QP2) + ":" + (PORT_QP_LE2) - + "\nserver.3=localhost:" + + "\nserver.3=127.0.0.1:" + (PORT_OBS)+ ":" + (PORT_OBS_LE) + ":observer"; String obsCfgSection = quorumCfgSection + "\npeerType=observer"; MainThread q1 = new MainThread(1, CLIENT_PORT_QP1, quorumCfgSection); @@ -94,16 +94,16 @@ q2.start(); q3.start(); assertTrue("waiting for server 1 being up", - ClientBase.waitForServerUp("localhost:" + CLIENT_PORT_QP1, + ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT_QP1, CONNECTION_TIMEOUT)); assertTrue("waiting for server 2 being up", - ClientBase.waitForServerUp("localhost:" + CLIENT_PORT_QP2, + ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT_QP2, CONNECTION_TIMEOUT)); assertTrue("waiting for server 3 being up", - ClientBase.waitForServerUp("localhost:" + CLIENT_PORT_OBS, + ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT_OBS, CONNECTION_TIMEOUT)); - zk = new ZooKeeper("localhost:" + CLIENT_PORT_OBS, + zk = new ZooKeeper("127.0.0.1:" + CLIENT_PORT_OBS, ClientBase.CONNECTION_TIMEOUT, this); zk.create("/obstest", "test".getBytes(),Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); @@ -122,7 +122,7 @@ q2.shutdown(); assertTrue("Waiting for server 2 to shut down", - ClientBase.waitForServerDown("localhost:"+CLIENT_PORT_QP2, + ClientBase.waitForServerDown("127.0.0.1:"+CLIENT_PORT_QP2, ClientBase.CONNECTION_TIMEOUT)); // Now the resulting ensemble shouldn't be quorate @@ -145,7 +145,7 @@ q2.start(); LOG.info("Waiting for server 2 to come up"); assertTrue("waiting for server 2 being up", - ClientBase.waitForServerUp("localhost:" + CLIENT_PORT_QP2, + ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT_QP2, CONNECTION_TIMEOUT)); latch.await(); @@ -162,13 +162,13 @@ zk.close(); assertTrue("Waiting for server 1 to shut down", - ClientBase.waitForServerDown("localhost:"+CLIENT_PORT_QP1, + ClientBase.waitForServerDown("127.0.0.1:"+CLIENT_PORT_QP1, ClientBase.CONNECTION_TIMEOUT)); assertTrue("Waiting for server 2 to shut down", - ClientBase.waitForServerDown("localhost:"+CLIENT_PORT_QP2, + ClientBase.waitForServerDown("127.0.0.1:"+CLIENT_PORT_QP2, ClientBase.CONNECTION_TIMEOUT)); assertTrue("Waiting for server 3 to shut down", - ClientBase.waitForServerDown("localhost:"+CLIENT_PORT_OBS, + ClientBase.waitForServerDown("127.0.0.1:"+CLIENT_PORT_OBS, ClientBase.CONNECTION_TIMEOUT)); } @@ -194,13 +194,13 @@ final int CLIENT_PORT_QP2 = PortAssignment.unique(); String quorumCfgSection = - "server.1=localhost:" + (CLIENT_PORT_QP1) + "server.1=127.0.0.1:" + (CLIENT_PORT_QP1) + ":" + (CLIENT_PORT_QP2) + "\npeerType=observer"; MainThread q1 = new MainThread(1, CLIENT_PORT_QP1, quorumCfgSection); q1.start(); assertFalse("Observer shouldn't come up", - ClientBase.waitForServerUp("localhost:" + CLIENT_PORT_QP1, + ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT_QP1, CONNECTION_TIMEOUT)); q1.shutdown();