[ https://issues.apache.org/jira/browse/HADOOP-10980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15406541#comment-15406541 ]
Jason Lowe commented on HADOOP-10980: ------------------------------------- bq. but I don't see how that is possible since it is explicitly set within the function. Please let me know if I'm missing something. The intent of overriding that method is to mock out both the ZK client _and_ the connection to the ZK server. If we just mocked out the ZK client itself then the logic in ActiveStandbyElector that uses the ZK client to connect to the server would either fail outright (as you intentionally do for this one, specific test) or the mock needs to be much more sophisticated to fool the connection code. Overriding the method that does both the client create and server connect is simpler for the vast majority of the tests that want to focus on mocking out functionality relevant when connected to the ZK server rather. +1 lgtm. I'll fix the indent nit flagged by checkstyle during the commit. > TestActiveStandbyElector fails occasionally in trunk > ---------------------------------------------------- > > Key: HADOOP-10980 > URL: https://issues.apache.org/jira/browse/HADOOP-10980 > Project: Hadoop Common > Issue Type: Test > Affects Versions: 3.0.0-alpha1 > Reporter: Ted Yu > Assignee: Eric Badger > Priority: Minor > Attachments: HADOOP-10980.001.patch, HADOOP-10980.002.patch, > HADOOP-10980.003.patch > > > From https://builds.apache.org/job/Hadoop-Common-trunk/1211/consoleFull : > {code} > Running org.apache.hadoop.ha.TestActiveStandbyElector > Tests run: 23, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.7 sec <<< > FAILURE! - in org.apache.hadoop.ha.TestActiveStandbyElector > testWithoutZKServer(org.apache.hadoop.ha.TestActiveStandbyElector) Time > elapsed: 0.051 sec <<< FAILURE! > java.lang.AssertionError: Did not throw zookeeper connection loss exceptions! > at org.junit.Assert.fail(Assert.java:88) > at > org.apache.hadoop.ha.TestActiveStandbyElector.testWithoutZKServer(TestActiveStandbyElector.java:722) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org