use of com.linecorp.armeria.common.AggregatedHttpRequest in project zipkin by openzipkin.
the class ITElasticsearchAuth method healthcheck_usesAuthAndTls.
@Test
void healthcheck_usesAuthAndTls() {
server.enqueue(VERSION_RESPONSE.toHttpResponse());
server.enqueue(YELLOW_RESPONSE.toHttpResponse());
assertThat(storage.check().ok()).isTrue();
AggregatedHttpRequest next = server.takeRequest().request();
// hard coded for sanity taken from https://en.wikipedia.org/wiki/Basic_access_authentication
assertThat(next.headers().get("Authorization")).isEqualTo("Basic QWxhZGRpbjpPcGVuU2VzYW1l");
}
use of com.linecorp.armeria.common.AggregatedHttpRequest in project zipkin by openzipkin.
the class ITElasticsearchDynamicCredentials method healthcheck_usesDynamicCredentialsAndTls.
@Test
void healthcheck_usesDynamicCredentialsAndTls() {
server.enqueue(VERSION_RESPONSE.toHttpResponse());
server.enqueue(YELLOW_RESPONSE.toHttpResponse());
assertThat(storage.check().ok()).isTrue();
AggregatedHttpRequest next = server.takeRequest().request();
assertThat(next.headers().get("Authorization")).isEqualTo("Basic Zm9vOmJhcg==");
}
use of com.linecorp.armeria.common.AggregatedHttpRequest in project zipkin by openzipkin.
the class ElasticsearchStorage method ensureIndexTemplatesAndClusterReady.
/**
* This allows the health check to display problems, such as access, installing the index
* template. It also helps reduce traffic sent to nodes still initializing (when guarded on the
* check result). Finally, this reads the cluster health of the index as it can go down after the
* one-time initialization passes.
*/
CheckResult ensureIndexTemplatesAndClusterReady(String index) {
try {
// ensure the version is available (even if we already cached it)
version();
// called only once, so we have to double-check health
ensureIndexTemplates();
AggregatedHttpRequest request = AggregatedHttpRequest.of(GET, "/_cluster/health/" + index);
CheckResult result = http().newCall(request, READ_STATUS, "get-cluster-health").execute();
if (result == null)
throw new IllegalArgumentException("No content reading cluster health");
return result;
} catch (Throwable e) {
Call.propagateIfFatal(e);
// Unwrap any IOException from the first call to ensureIndexTemplates()
if (e instanceof RejectedExecutionException || e instanceof UncheckedIOException) {
e = e.getCause();
}
return CheckResult.failed(e);
}
}
use of com.linecorp.armeria.common.AggregatedHttpRequest in project zipkin by openzipkin.
the class ElasticsearchStorage method clear.
void clear(String index) throws IOException {
String url = '/' + index;
AggregatedHttpRequest delete = AggregatedHttpRequest.of(HttpMethod.DELETE, url);
http().newCall(delete, BodyConverters.NULL, "delete-index").execute();
}
use of com.linecorp.armeria.common.AggregatedHttpRequest in project zipkin by openzipkin.
the class ITEnsureIndexTemplate method http.
void http(HttpMethod method, String path) throws IOException {
AggregatedHttpRequest delete = AggregatedHttpRequest.of(method, path);
Internal.instance.http(storage).newCall(delete, (parser, contentString) -> null, method + "-" + path).execute();
}
Aggregations