xiangfu0 commented on code in PR #17167:
URL: https://github.com/apache/pinot/pull/17167#discussion_r3038908845
##########
pinot-controller/src/test/java/org/apache/pinot/controller/api/PinotInstanceRestletResourceTest.java:
##########
@@ -274,23 +271,20 @@ public void instanceRetagServerDeficiencyTest()
}
private Map<String, List<String>> getCurrentInstanceTagsMap()
- throws IOException {
- String listInstancesUrl = _urlBuilder.forInstanceList();
- JsonNode response =
JsonUtils.stringToJsonNode(sendGetRequest(listInstancesUrl));
- JsonNode instances = response.get("instances");
+ throws Exception {
+ PinotAdminClient adminClient = DEFAULT_INSTANCE.getOrCreateAdminClient();
+ List<String> instances = adminClient.getInstanceClient().listInstances();
Map<String, List<String>> map = new HashMap<>(instances.size());
- for (int i = 0; i < instances.size(); i++) {
- String instance = instances.get(i).asText();
- map.put(instance, getInstanceTags(instance));
+ for (String instance : instances) {
+ map.put(instance, getInstanceTags(adminClient, instance));
}
return map;
}
- private List<String> getInstanceTags(String instance)
- throws IOException {
- String getInstancesUrl = _urlBuilder.forInstance(instance);
+ private List<String> getInstanceTags(PinotAdminClient adminClient, String
instance)
+ throws Exception {
List<String> tags = new ArrayList<>();
- for (JsonNode tag :
JsonUtils.stringToJsonNode(sendGetRequest(getInstancesUrl)).get("tags")) {
+ for (JsonNode tag :
JsonUtils.stringToJsonNode(adminClient.getInstanceClient().getInstance(instance)).get("tags"))
{
Review Comment:
create a api to get instance tags and use it here
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]