Github user anmolnar commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/500#discussion_r180793047
  
    --- Diff: src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java 
---
    @@ -245,6 +245,180 @@ public void testLastAcceptedEpoch() throws Exception {
                 recursiveDelete(tmpDir);
             }
         }
    +
    +    @Test
    +    public void testGetEpochToProposeWithObserver() throws Exception {
    +        File tmpDir = File.createTempFile("test", "dir", testData);
    +        tmpDir.delete();
    +        tmpDir.mkdir();
    +        Leader leader = null;
    +        try {
    +            QuorumPeer peer = createQuorumPeer(tmpDir);
    +            long participantId = 1;
    +            long observerId = peer.quorumPeers.size();
    +            peer.quorumPeers.put(observerId, new QuorumServer(observerId, 
"0.0.0.0", 33225,
    --- End diff --
    
    I think to be consistent with `createQuorumPeer()` method this should be 
something like:
    ```
    peers.put(observerId, new QuorumServer(observerId, new 
InetSocketAddress("127.0.0.1", PortAssignment.unique()), 
                   new InetSocketAddress("127.0.0.1", PortAssignment.unique()),
                   new InetSocketAddress("127.0.0.1", PortAssignment.unique()),
                   QuorumPeer.LearnerType.OBSERVER));
    ```



---

Reply via email to