avijayanhwx commented on a change in pull request #681: HDDS-3153. Create REST API to serve Recon Dashboard and integrate with UI in Recon. URL: https://github.com/apache/hadoop-ozone/pull/681#discussion_r393208221
########## File path: hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/api/TestEndpoints.java ########## @@ -305,4 +419,39 @@ public void testGetPipelines() throws Exception { return (pipelineMetadata1.getContainers() == 1); }); } + + @Test + public void testGetClusterState() throws Exception { + Response response = clusterStateEndpoint.getClusterState(); + ClusterStateResponse clusterStateResponse = + (ClusterStateResponse) response.getEntity(); + + Assert.assertEquals(1, clusterStateResponse.getPipelines()); + Assert.assertEquals(2, clusterStateResponse.getVolumes()); + Assert.assertEquals(2, clusterStateResponse.getBuckets()); + Assert.assertEquals(3, clusterStateResponse.getKeys()); + Assert.assertEquals(2, clusterStateResponse.getTotalDatanodes()); + Assert.assertEquals(2, clusterStateResponse.getHealthyDatanodes()); + + DatanodeStorageReport storageReport = + clusterStateResponse.getStorageReport(); + + + // if container report is processed first, and pipeline does not exist + // then container is not added until the next container report is processed + SCMHeartbeatRequestProto heartbeatRequestProto = + SCMHeartbeatRequestProto.newBuilder() + .setContainerReport(containerReportsProto) + .setDatanodeDetails(datanodeDetailsProto) + .build(); + reconScm.getDatanodeProtocolServer() + .sendHeartbeat(heartbeatRequestProto); + + LambdaTestUtils.await(30000, 2000, () -> { Review comment: Thanks! ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org