mirror of https://github.com/apache/lucene.git
SOLR-8048: Close the http client in a finally clause at the end of the test
(cherry picked from commit 2d6b7ea
)
This commit is contained in:
parent
50a9153462
commit
31316f7682
|
@ -86,7 +86,9 @@ public class BasicAuthIntegrationTest extends TestMiniSolrCloudClusterBase {
|
|||
cloudSolrClient.setDefaultCollection(null);
|
||||
|
||||
NamedList<Object> rsp;
|
||||
HttpClient cl = HttpClientUtil.createClient(null);
|
||||
HttpClient cl = null;
|
||||
try {
|
||||
cl = HttpClientUtil.createClient(null);
|
||||
String baseUrl = getRandomReplica(zkStateReader.getClusterState().getCollection(defaultCollName), random()).getStr(BASE_URL_PROP);
|
||||
verifySecurityStatus(cl, baseUrl + authcPrefix, "/errorMessages", null, 20);
|
||||
zkClient.setData("/security.json", STD_CONF.replaceAll("'", "\"").getBytes(UTF_8), true);
|
||||
|
@ -214,8 +216,12 @@ public class BasicAuthIntegrationTest extends TestMiniSolrCloudClusterBase {
|
|||
"; stdout from tool prior to failure: " + baos.toString(StandardCharsets.UTF_8.name()));
|
||||
}
|
||||
executeCommand(baseUrl + authzPrefix, cl, "{set-property : { blockUnknown: false}}", "harry", "HarryIsUberCool");
|
||||
} finally {
|
||||
if (cl != null) {
|
||||
HttpClientUtil.close(cl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void executeCommand(String url, HttpClient cl, String payload, String user, String pwd) throws IOException {
|
||||
HttpPost httpPost;
|
||||
|
|
Loading…
Reference in New Issue