Search in sources :

Example 1 with RecordedRequest

use of com.linecorp.armeria.testing.junit5.server.mock.RecordedRequest in project opentelemetry-java by open-telemetry.

the class OtlpHttpLogExporterTest method testExportTls.

@Test
void testExportTls() {
    server.enqueue(successResponse());
    OtlpHttpLogExporter exporter = builder.setEndpoint("https://" + canonicalHostName + ":" + server.httpsPort() + "/v1/logs").setTrustedCertificates(HELD_CERTIFICATE.certificatePem().getBytes(StandardCharsets.UTF_8)).build();
    ExportLogsServiceRequest payload = exportAndAssertResult(exporter, /* expectedResult= */
    true);
    RecordedRequest recorded = server.takeRequest();
    AggregatedHttpRequest request = recorded.request();
    assertRequestCommon(request);
    assertThat(parseRequestBody(request.content().array())).isEqualTo(payload);
    // OkHttp does support HTTP/2 upgrade on TLS.
    assertThat(recorded.context().sessionProtocol().isMultiplex()).isTrue();
}
Also used : RecordedRequest(com.linecorp.armeria.testing.junit5.server.mock.RecordedRequest) ExportLogsServiceRequest(io.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest) AggregatedHttpRequest(com.linecorp.armeria.common.AggregatedHttpRequest) Test(org.junit.jupiter.api.Test)

Example 2 with RecordedRequest

use of com.linecorp.armeria.testing.junit5.server.mock.RecordedRequest in project opentelemetry-java by open-telemetry.

the class OtlpHttpSpanExporterTest method testExportTls.

@Test
void testExportTls() {
    server.enqueue(successResponse());
    OtlpHttpSpanExporter exporter = builder.setEndpoint("https://" + canonicalHostName + ":" + server.httpsPort() + "/v1/traces").setTrustedCertificates(HELD_CERTIFICATE.certificatePem().getBytes(StandardCharsets.UTF_8)).build();
    ExportTraceServiceRequest payload = exportAndAssertResult(exporter, /* expectedResult= */
    true);
    RecordedRequest recorded = server.takeRequest();
    AggregatedHttpRequest request = recorded.request();
    assertRequestCommon(request);
    assertThat(parseRequestBody(request.content().array())).isEqualTo(payload);
    // OkHttp does support HTTP/2 upgrade on TLS.
    assertThat(recorded.context().sessionProtocol().isMultiplex()).isTrue();
}
Also used : ExportTraceServiceRequest(io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest) RecordedRequest(com.linecorp.armeria.testing.junit5.server.mock.RecordedRequest) AggregatedHttpRequest(com.linecorp.armeria.common.AggregatedHttpRequest) Test(org.junit.jupiter.api.Test)

Example 3 with RecordedRequest

use of com.linecorp.armeria.testing.junit5.server.mock.RecordedRequest in project opentelemetry-java by open-telemetry.

the class OtlpHttpSpanExporterTest method testExportUncompressed.

@Test
void testExportUncompressed() {
    server.enqueue(successResponse());
    OtlpHttpSpanExporter exporter = builder.build();
    ExportTraceServiceRequest payload = exportAndAssertResult(exporter, /* expectedResult= */
    true);
    RecordedRequest recorded = server.takeRequest();
    AggregatedHttpRequest request = recorded.request();
    assertRequestCommon(request);
    assertThat(parseRequestBody(request.content().array())).isEqualTo(payload);
    // OkHttp does not support HTTP/2 upgrade on plaintext.
    assertThat(recorded.context().sessionProtocol().isMultiplex()).isFalse();
}
Also used : ExportTraceServiceRequest(io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest) RecordedRequest(com.linecorp.armeria.testing.junit5.server.mock.RecordedRequest) AggregatedHttpRequest(com.linecorp.armeria.common.AggregatedHttpRequest) Test(org.junit.jupiter.api.Test)

Example 4 with RecordedRequest

use of com.linecorp.armeria.testing.junit5.server.mock.RecordedRequest in project opentelemetry-java by open-telemetry.

the class OtlpHttpLogExporterTest method testExportUncompressed.

@Test
void testExportUncompressed() {
    server.enqueue(successResponse());
    OtlpHttpLogExporter exporter = builder.build();
    ExportLogsServiceRequest payload = exportAndAssertResult(exporter, /* expectedResult= */
    true);
    RecordedRequest recorded = server.takeRequest();
    AggregatedHttpRequest request = recorded.request();
    assertRequestCommon(request);
    assertThat(parseRequestBody(request.content().array())).isEqualTo(payload);
    // OkHttp does not support HTTP/2 upgrade on plaintext.
    assertThat(recorded.context().sessionProtocol().isMultiplex()).isFalse();
}
Also used : RecordedRequest(com.linecorp.armeria.testing.junit5.server.mock.RecordedRequest) ExportLogsServiceRequest(io.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest) AggregatedHttpRequest(com.linecorp.armeria.common.AggregatedHttpRequest) Test(org.junit.jupiter.api.Test)

Aggregations

AggregatedHttpRequest (com.linecorp.armeria.common.AggregatedHttpRequest)4 RecordedRequest (com.linecorp.armeria.testing.junit5.server.mock.RecordedRequest)4 Test (org.junit.jupiter.api.Test)4 ExportLogsServiceRequest (io.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest)2 ExportTraceServiceRequest (io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest)2