Fix resource leak in TestPolicyCloud (#1312)

This commit is contained in:
Tomas Fernandez Lobbe 2020-03-03 11:42:20 -08:00 committed by GitHub
parent fa6166f261
commit 4d2d052b7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 24 deletions

View File

@ -145,7 +145,7 @@ public class TestPolicyCloud extends SolrCloudTestCase {
"}";
AutoScalingConfig config = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScaleJson));
AtomicInteger count = new AtomicInteger(0);
SolrCloudManager cloudManager = new SolrClientCloudManager(new ZkDistributedQueueFactory(cluster.getZkClient()), cluster.getSolrClient());
try (SolrCloudManager cloudManager = new SolrClientCloudManager(new ZkDistributedQueueFactory(cluster.getZkClient()), cluster.getSolrClient())) {
String nodeName = cloudManager.getClusterStateProvider().getLiveNodes().iterator().next();
SolrClientNodeStateProvider nodeStateProvider = (SolrClientNodeStateProvider) cloudManager.getNodeStateProvider();
Map<String, Map<String, List<ReplicaInfo>>> result = nodeStateProvider.getReplicaInfo(nodeName, Collections.singleton("UPDATE./update.requests"));
@ -172,7 +172,7 @@ public class TestPolicyCloud extends SolrCloudTestCase {
}));
}
assertTrue(count.get() > 0);
}
}
private static CollectionStatePredicate expectAllReplicasOnSpecificNode