From dev-return-78733-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Sun Feb 24 09:27:25 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id A2F7A18077A for ; Sun, 24 Feb 2019 10:27:24 +0100 (CET) Received: (qmail 92440 invoked by uid 500); 24 Feb 2019 09:27:23 -0000 Mailing-List: contact dev-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list dev@zookeeper.apache.org Received: (qmail 92429 invoked by uid 99); 24 Feb 2019 09:27:23 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Feb 2019 09:27:23 +0000 From: GitBox To: dev@zookeeper.apache.org Subject: [GitHub] eolivelli commented on a change in pull request #832: ZOOKEEPER-2503:do a hard constraints on the number of myid which must be between 1 and 255 Message-ID: <155100044300.18025.16911440646087650949.gitbox@gitbox.apache.org> Date: Sun, 24 Feb 2019 09:27:23 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit eolivelli commented on a change in pull request #832: ZOOKEEPER-2503:do a hard constraints on the number of myid which must be between 1 and 255 URL: https://github.com/apache/zookeeper/pull/832#discussion_r259610908 ########## File path: zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java ########## @@ -436,6 +438,35 @@ public void testElectionFraud() throws IOException, InterruptedException { Assert.assertTrue("falseLeader never rejoins the quorum", foundFollowing); } + @Test + public void testBadMyId() throws Exception { + ClientBase.setupTestEnv(); + + final int CLIENT_PORT_QP1 = PortAssignment.unique(); + List invalidMyidList = new ArrayList<>(); + invalidMyidList.add(-1); + invalidMyidList.add(0); + invalidMyidList.add(256); + invalidMyidList.add(1024); + for (Integer myidForCheck : invalidMyidList) { + String quorumCfgSection = "server.1=127.0.0.1:" + + PortAssignment.unique() + ":" + PortAssignment.unique() + + "\nserver." + myidForCheck + "=127.0.0.1:" + PortAssignment.unique() + ":" + + PortAssignment.unique(); + + MainThread q1 = new MainThread(myidForCheck, CLIENT_PORT_QP1, quorumCfgSection); Review comment: Do we really need to setup all of this stuff in order to test one simple validation? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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 With regards, Apache Git Services