You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2019/09/26 00:59:31 UTC
[GitHub] [incubator-pinot] siddharthteotia commented on a change in pull
request #4649: Use timed wait around get() calls in
PinotInstanceRestletResourceTest
siddharthteotia commented on a change in pull request #4649: Use timed wait around get() calls in PinotInstanceRestletResourceTest
URL: https://github.com/apache/incubator-pinot/pull/4649#discussion_r328397675
##########
File path: pinot-controller/src/test/java/org/apache/pinot/controller/api/PinotInstanceRestletResourceTest.java
##########
@@ -54,9 +57,17 @@ public void testInstanceListingAndCreation()
throws Exception {
// Check that there is only one CONTROLLER instance in the cluster
String listInstancesUrl = _controllerRequestURLBuilder.forInstanceList();
- JsonNode instanceList = JsonUtils.stringToJsonNode(sendGetRequest(listInstancesUrl));
- assertEquals(instanceList.get("instances").size(), 1);
- assertTrue(instanceList.get("instances").get(0).asText().startsWith(Helix.PREFIX_OF_CONTROLLER_INSTANCE));
+
+ TestUtils.waitForCondition(aVoid -> {
+ try {
+ String getResponse = sendGetRequest(listInstancesUrl);
+ JsonNode jsonNode = JsonUtils.stringToJsonNode(getResponse);
+ return jsonNode.get("instances").size() == 1 && jsonNode.get("instances").get(0).asText()
+ .startsWith(Helix.PREFIX_OF_CONTROLLER_INSTANCE);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
Review comment:
We have to throw exception if getRequest fails for any arbitrary reason as in that case, retry might not help. Made the changes to check for null result though
----------------------------------------------------------------
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
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org