From 180640b2e2de38b50e0711880902d8f452bf1584 Mon Sep 17 00:00:00 2001 From: Alan West <3676547+alanwest@users.noreply.github.com> Date: Wed, 13 Jan 2021 15:15:21 -0800 Subject: [PATCH] Set switch allowing for insecure GrpcChannel for netcoreapp3.1 --- .../IntegrationTests.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTests.cs b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTests.cs index 1bae0cf38a5..1d001eeefe7 100644 --- a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTests.cs +++ b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTests.cs @@ -14,6 +14,7 @@ // limitations under the License. // +using System; using System.Diagnostics; using OpenTelemetry.Tests; using OpenTelemetry.Trace; @@ -30,6 +31,13 @@ public class IntegrationTests [SkipUnlessEnvVarFoundFact(CollectorEndpointEnvVarName)] public void ExportResultIsSuccess() { +#if NETCOREAPP3_1 + // Adding the OtlpExporter creates a GrpcChannel. + // This switch must be set before creating a GrpcChannel/HttpClient when calling an insecure gRPC service. + // See: https://docs.microsoft.com/aspnet/core/grpc/troubleshoot#call-insecure-grpc-services-with-net-core-client + AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); +#endif + var exporterOptions = new OtlpExporterOptions { #if NETCOREAPP3_1 || NET5_0