Grpc.Net.Client - multi library version test (#2347)

This commit is contained in:
Piotr Kiełkowicz 2023-03-20 09:24:12 +01:00 committed by GitHub
parent 8f1c681e9f
commit 94d4aff0b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 7 deletions

View File

@ -37,6 +37,14 @@ public static class LibraryVersion
"2.4.0",
}
},
{
"TestApplication.GrpcNetClient",
new List<string>
{
"2.43.0",
"2.52.0",
}
},
{
"TestApplication.MassTransit",
new List<string>

View File

@ -9,8 +9,8 @@
<PackageVersion Include="GraphQL.Server.Transports.AspNetCore" Version="3.4.0" />
<PackageVersion Include="GraphQL.Server.Ui.Playground" Version="3.4.0" />
<PackageVersion Include="GraphQL.StarWars" Version="1.0.0" />
<PackageVersion Include="Grpc.Net.Client" Version="2.43.0" />
<PackageVersion Include="Grpc.Net.Client.Web" Version="2.43.0" />
<PackageVersion Include="Grpc.Net.Client" Version="2.52.0" />
<PackageVersion Include="Grpc.Net.Client.Web" Version="2.52.0" />
<PackageVersion Include="Grpc.Tools" Version="2.51.0" />
<PackageVersion Include="MassTransit" Version="8.0.13" />
<PackageVersion Include="Microsoft.AspNetCore" Version="2.2.0" />

View File

@ -26,9 +26,10 @@ public class GrpcNetClientTests : TestHelper
{
}
[Fact]
[Theory]
[Trait("Category", "EndToEnd")]
public void SubmitsTraces()
[MemberData(nameof(LibraryVersion.GrpcNetClient), MemberType = typeof(LibraryVersion))]
public void SubmitsTraces(string packageVersion)
{
using var collector = new MockSpansCollector(Output);
SetExporter(collector);
@ -38,7 +39,7 @@ public class GrpcNetClientTests : TestHelper
// Enabling only GrpcNetClient instrumentation to have consistent set of spans.
SetEnvironmentVariable("OTEL_DOTNET_AUTO_TRACES_INSTRUMENTATION_ENABLED", "false");
SetEnvironmentVariable("OTEL_DOTNET_AUTO_TRACES_GRPCNETCLIENT_INSTRUMENTATION_ENABLED", "true");
RunTestApplication();
RunTestApplication(new TestSettings { PackageVersion = packageVersion });
collector.AssertExpectations();
}

View File

@ -38,6 +38,15 @@ public static class LibraryVersion
#else
new object[] { "2.3.0" },
new object[] { "2.4.0" },
#endif
};
public static readonly IReadOnlyCollection<object[]> GrpcNetClient = new List<object[]>
{
#if DEFAULT_TEST_PACKAGE_VERSIONS
new object[] { string.Empty }
#else
new object[] { "2.43.0" },
new object[] { "2.52.0" },
#endif
};
public static readonly IReadOnlyCollection<object[]> MassTransit = new List<object[]>

View File

@ -8,8 +8,8 @@
<ItemGroup>
<PackageReference Include="Google.Protobuf" VersionOverride="3.19.4" />
<PackageReference Include="Grpc.Net.Client" />
<PackageReference Include="Grpc.Net.Client.Web" Condition="'$(TargetFramework)' == 'net462'" />
<PackageReference Include="Grpc.Net.Client" VersionOverride="$(LibraryVersion)" />
<PackageReference Include="Grpc.Net.Client.Web" Condition="'$(TargetFramework)' == 'net462'" VersionOverride="$(LibraryVersion)" />
<PackageReference Include="Grpc.Tools" VersionOverride="2.44.0" />
<!-- Workaround! Microsoft.Extensions.Logging.Abstractions v.3.1.0 is minimal version supported by auto instrumentation.
Grpc.Net.Client references older version. It prevents to load required version from Additional Dependencies store-->

View File

@ -54,6 +54,17 @@ internal static class PackageVersionDefinitions
}
},
new()
{
IntegrationName = "GrpcNetClient",
NugetPackageName = "Grpc.Net.Client",
TestApplicationName = "TestApplication.GrpcNetClient",
Versions = new List<string>
{
"2.43.0",
"*"
}
},
new()
{
IntegrationName = "MassTransit",
NugetPackageName = "MassTransit",