Skip to content

Commit 82324bf

Browse files
authored
Fix gRPC interop tests (#24824)
1 parent ca1505b commit 82324bf

File tree

6 files changed

+19
-11
lines changed

6 files changed

+19
-11
lines changed

src/Grpc/test/InteropTests/InteropTests.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
<PropertyGroup>
44
<ContainsFunctionalTestAssets>true</ContainsFunctionalTestAssets>
55
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
6-
7-
<!-- https://github.com/dotnet/aspnetcore/issues/24182 -->
8-
<BuildHelixPayload>false</BuildHelixPayload>
96
</PropertyGroup>
107

118
<ItemGroup>

src/Grpc/test/testassets/InteropClient/InteropClient.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
using Google.Protobuf;
3030
using Grpc.Auth;
3131
using Grpc.Core;
32-
using Grpc.Core.Utils;
3332
using Grpc.Net.Client;
3433
using Grpc.Testing;
3534
using Microsoft.Extensions.DependencyInjection;
@@ -96,11 +95,12 @@ private InteropClient(ClientOptions options)
9695
var services = new ServiceCollection();
9796
services.AddLogging(configure =>
9897
{
99-
configure.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
100-
configure.AddSimpleConsole(loggerOptions =>
98+
configure.SetMinimumLevel(LogLevel.Trace);
99+
configure.AddConsole(loggerOptions =>
101100
{
101+
#pragma warning disable CS0618 // Type or member is obsolete
102102
loggerOptions.IncludeScopes = true;
103-
loggerOptions.DisableColors = true;
103+
#pragma warning restore CS0618 // Type or member is obsolete
104104
});
105105
});
106106

src/Grpc/test/testassets/InteropClient/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#endregion
1818

1919
using System;
20+
using System.Reflection;
2021

2122
namespace InteropTestsClient
2223
{
@@ -26,6 +27,9 @@ public static void Main(string[] args)
2627
{
2728
Console.WriteLine("Application started.");
2829

30+
var runtimeVersion = typeof(object).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown";
31+
Console.WriteLine($"NetCoreAppVersion: {runtimeVersion}");
32+
2933
InteropClient.Run(args);
3034
}
3135
}

src/Grpc/test/testassets/InteropWebsite/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
3737
Host.CreateDefaultBuilder(args)
3838
.ConfigureLogging(builder =>
3939
{
40-
builder.AddSimpleConsole(o => o.DisableColors = true);
40+
builder.AddConsole();
4141
builder.SetMinimumLevel(LogLevel.Trace);
4242
})
4343
.ConfigureWebHostDefaults(webBuilder =>

src/Grpc/test/testassets/InteropWebsite/Startup.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#endregion
1818

1919
using System;
20+
using System.Reflection;
2021
using Grpc.Testing;
2122
using Microsoft.AspNetCore.Builder;
2223
using Microsoft.Extensions.DependencyInjection;
@@ -37,7 +38,13 @@ public void ConfigureServices(IServiceCollection services)
3738
public void Configure(IApplicationBuilder app, IHostApplicationLifetime applicationLifetime)
3839
{
3940
// Required to notify test infrastructure that it can begin tests
40-
applicationLifetime.ApplicationStarted.Register(() => Console.WriteLine("Application started."));
41+
applicationLifetime.ApplicationStarted.Register(() =>
42+
{
43+
Console.WriteLine("Application started.");
44+
45+
var runtimeVersion = typeof(object).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown";
46+
Console.WriteLine($"NetCoreAppVersion: {runtimeVersion}");
47+
});
4148

4249
app.UseRouting();
4350
app.UseEndpoints(endpoints =>

src/Shared/Process/ProcessEx.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ public void WaitForExit(bool assertSuccess, TimeSpan? timeSpan = null)
218218
private static string GetNugetPackagesRestorePath() => (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("NUGET_RESTORE")))
219219
? typeof(ProcessEx).Assembly
220220
.GetCustomAttributes<AssemblyMetadataAttribute>()
221-
.First(attribute => attribute.Key == "TestPackageRestorePath")
222-
.Value
221+
.FirstOrDefault(attribute => attribute.Key == "TestPackageRestorePath")
222+
?.Value
223223
: Environment.GetEnvironmentVariable("NUGET_RESTORE");
224224

225225
public void Dispose()

0 commit comments

Comments
 (0)