Fix gRPC interop tests (#24824)

This commit is contained in:
James Newton-King 2020-08-13 17:48:26 +12:00 committed by GitHub
parent ca1505ba3b
commit 82324bf357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 11 deletions

View File

@ -3,9 +3,6 @@
<PropertyGroup>
<ContainsFunctionalTestAssets>true</ContainsFunctionalTestAssets>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<!-- https://github.com/dotnet/aspnetcore/issues/24182 -->
<BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup>
<ItemGroup>

View File

@ -29,7 +29,6 @@ using Google.Apis.Auth.OAuth2;
using Google.Protobuf;
using Grpc.Auth;
using Grpc.Core;
using Grpc.Core.Utils;
using Grpc.Net.Client;
using Grpc.Testing;
using Microsoft.Extensions.DependencyInjection;
@ -96,11 +95,12 @@ namespace InteropTestsClient
var services = new ServiceCollection();
services.AddLogging(configure =>
{
configure.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
configure.AddSimpleConsole(loggerOptions =>
configure.SetMinimumLevel(LogLevel.Trace);
configure.AddConsole(loggerOptions =>
{
#pragma warning disable CS0618 // Type or member is obsolete
loggerOptions.IncludeScopes = true;
loggerOptions.DisableColors = true;
#pragma warning restore CS0618 // Type or member is obsolete
});
});

View File

@ -17,6 +17,7 @@
#endregion
using System;
using System.Reflection;
namespace InteropTestsClient
{
@ -26,6 +27,9 @@ namespace InteropTestsClient
{
Console.WriteLine("Application started.");
var runtimeVersion = typeof(object).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown";
Console.WriteLine($"NetCoreAppVersion: {runtimeVersion}");
InteropClient.Run(args);
}
}

View File

@ -37,7 +37,7 @@ namespace InteropTestsWebsite
Host.CreateDefaultBuilder(args)
.ConfigureLogging(builder =>
{
builder.AddSimpleConsole(o => o.DisableColors = true);
builder.AddConsole();
builder.SetMinimumLevel(LogLevel.Trace);
})
.ConfigureWebHostDefaults(webBuilder =>

View File

@ -17,6 +17,7 @@
#endregion
using System;
using System.Reflection;
using Grpc.Testing;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
@ -37,7 +38,13 @@ namespace InteropTestsWebsite
public void Configure(IApplicationBuilder app, IHostApplicationLifetime applicationLifetime)
{
// Required to notify test infrastructure that it can begin tests
applicationLifetime.ApplicationStarted.Register(() => Console.WriteLine("Application started."));
applicationLifetime.ApplicationStarted.Register(() =>
{
Console.WriteLine("Application started.");
var runtimeVersion = typeof(object).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown";
Console.WriteLine($"NetCoreAppVersion: {runtimeVersion}");
});
app.UseRouting();
app.UseEndpoints(endpoints =>

View File

@ -218,8 +218,8 @@ namespace Microsoft.AspNetCore.Internal
private static string GetNugetPackagesRestorePath() => (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("NUGET_RESTORE")))
? typeof(ProcessEx).Assembly
.GetCustomAttributes<AssemblyMetadataAttribute>()
.First(attribute => attribute.Key == "TestPackageRestorePath")
.Value
.FirstOrDefault(attribute => attribute.Key == "TestPackageRestorePath")
?.Value
: Environment.GetEnvironmentVariable("NUGET_RESTORE");
public void Dispose()