You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/08/26 07:29:44 UTC

[GitHub] [lucene-solr] janhoy commented on a change in pull request #1771: SOLR-14752: Fix zk status with prometheus enabled zookeeper

janhoy commented on a change in pull request #1771:
URL: https://github.com/apache/lucene-solr/pull/1771#discussion_r477091492



##########
File path: solr/core/src/test/org/apache/solr/handler/admin/ZookeeperStatusHandlerTest.java
##########
@@ -211,4 +211,39 @@ public void testMntrBugZk36Solr14463() {
         "  \"status\":\"red\"}";
     assertEquals(expected, JSONUtil.toJSON(mockStatus));
   }
+
+  @Test
+  public void testZkWithPrometheusSolr14752() {
+    assumeWorkingMockito();
+    ZookeeperStatusHandler zkStatusHandler = mock(ZookeeperStatusHandler.class);
+    when(zkStatusHandler.getZkRawResponse("zoo1:2181", "ruok")).thenReturn(Arrays.asList("imok"));
+    when(zkStatusHandler.getZkRawResponse("zoo1:2181", "mntr")).thenReturn(
+        Arrays.asList("zk_version\t3.6.1--104dcb3e3fb464b30c5186d229e00af9f332524b, built on 04/21/2020 15:01 GMT",
+            "zk_avg_latency\t0.24",
+            "zk_server_state\tleader",
+            "zk_synced_followers\t2.0"));
+    when(zkStatusHandler.getZkRawResponse("zoo1:2181", "conf")).thenReturn(
+        Arrays.asList("clientPort=2181"));
+    when(zkStatusHandler.getZkStatus(anyString(), any())).thenCallRealMethod();
+    when(zkStatusHandler.monitorZookeeper(anyString())).thenCallRealMethod();
+    when(zkStatusHandler.validateZkRawResponse(ArgumentMatchers.any(), any(), any())).thenAnswer(Answers.CALLS_REAL_METHODS);
+
+    Map<String, Object> mockStatus = zkStatusHandler.getZkStatus("zoo1:2181", ZkDynamicConfig.fromZkConnectString("zoo1:2181"));
+    String expected = "{\n" +

Review comment:
       This check seems wrong for what we want to test here. Sure, the check succeeds since there is no NumberFormatException anywhere, but it would be better with a smaller test that does not trigger any other errors.




----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org