From c48b7a7a97a629e3272583ff511d9f960d63e4a5 Mon Sep 17 00:00:00 2001 From: javanna Date: Fri, 3 Jun 2016 18:08:37 +0200 Subject: [PATCH] [TEST] create standard RestClient at first request and reuse it A RestClient instance is now created whenever EsIntegTestCase#getRestClient is invoked for the first time. It is then kept until the cluster is cleared (depending on the cluster scope of the test). Renamed other two restClient methods to createRestClient, as that instance needs to be closed and managed in the tests. --- .../elasticsearch/transport/ContextAndHeaderTransportIT.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportIT.java b/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportIT.java index ecee90f313b..6dd6114ce79 100644 --- a/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportIT.java +++ b/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportIT.java @@ -219,7 +219,8 @@ public class ContextAndHeaderTransportIT extends ESIntegTestCase { restController.registerRelevantHeaders(relevantHeaderName); } - try (ElasticsearchResponse response = getRestClient().performRequest("GET", "/" + queryIndex + "/_search", Collections.emptyMap(), null, + try (ElasticsearchResponse response = getRestClient().performRequest( + "GET", "/" + queryIndex + "/_search", Collections.emptyMap(), null, new BasicHeader(randomHeaderKey, randomHeaderValue), new BasicHeader(relevantHeaderName, randomHeaderValue))) { assertThat(response, hasStatus(OK)); List searchRequests = getRequests(SearchRequest.class);