zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phunt <...@git.apache.org>
Subject [GitHub] zookeeper pull request #432: ZOOKEEPER-2953: Flaky Test: testNoLogBeforeLead...
Date Sat, 16 Dec 2017 00:31:55 GMT
Github user phunt commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/432#discussion_r157326074
  
    --- Diff: src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java ---
    @@ -335,6 +336,100 @@ public void testHighestZxidJoinLate() throws Exception {
                     output[0], 2);
         }
     
    +    /**
    +     * This test validates that if a quorum member determines that it is leader without
the support of the rest of the
    +     * quorum (the other members do not believe it to be the leader) it will stop attempting
to lead and become a follower.
    +     *
    +     * @throws IOException
    +     * @throws InterruptedException
    +     */
    +    @Test
    +    public void testElectionFraud() throws IOException, InterruptedException {
    +        // capture QuorumPeer logging
    +        Layout layout = Logger.getRootLogger().getAppender("CONSOLE").getLayout();
    +        ByteArrayOutputStream os = new ByteArrayOutputStream();
    +        WriterAppender appender = new WriterAppender(layout, os);
    +        appender.setThreshold(Level.INFO);
    +        Logger qlogger = Logger.getLogger(QuorumPeer.class);
    +        qlogger.addAppender(appender);
    +
    +        numServers = 3;
    +
    +        // used for assertions later
    +        boolean foundLeading = false;
    +        boolean foundLooking = false;
    +        boolean foundFollowing = false;
    +
    +        try {
    +          // spin up a quorum, we use a small ticktime to make the test run faster
    +          servers = LaunchServers(numServers, 500);
    --- End diff --
    
    Note that by reducing this you are also affecting the init and sync limits  in the same
proportion... Not a reason not to do it but FYI in case we start seeing this test as flakey
down the road. :-)


---

Mime
View raw message