You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/11/11 10:55:24 UTC
[GitHub] [zookeeper] eolivelli commented on a change in pull request #1525: ZOOKEEPER-3994:Disconnect reason is wrong for NOT_READ_ONLY_CLIENT and CLIENT_ZXID_AHEAD
eolivelli commented on a change in pull request #1525:
URL: https://github.com/apache/zookeeper/pull/1525#discussion_r521276106
##########
File path: zookeeper-server/src/test/java/org/apache/zookeeper/server/ZooKeeperServerTest.java
##########
@@ -135,4 +138,32 @@ public void testInvalidSnapshot() {
}
}
+ @Test
+ public void testClientZxidAhead() {
+ ZooKeeperServer zooKeeperServer = new ZooKeeperServer();
+ final ZKDatabase zkDatabase = new ZKDatabase(mock(FileTxnSnapLog.class));
+ zooKeeperServer.setZKDatabase(zkDatabase);
+
+ final ByteBuffer output = ByteBuffer.allocate(30);
+ // serialize a connReq
+ output.putInt(1);
+ // lastZxid
+ output.putLong(99L);
+ output.putInt(500);
+ output.putLong(123L);
+ output.putInt(1);
+ output.put((byte) 1);
+ output.put((byte) 1);
+ output.flip();
+
+ try {
+ final NIOServerCnxn nioServerCnxn = mock(NIOServerCnxn.class);
+ zooKeeperServer.processConnectRequest(nioServerCnxn, output);
+ } catch (Exception e) {
+ // expect
+ assertTrue(TestServerCnxn.instanceofCloseRequestException(e));
Review comment:
As a tradeoff we can use e.getClass().getName() and make the assertion against the string
this why we don't have to add that trick and also we do not have to add a new public class
@anmolnar would it work for you ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org