Skip to content

Fix gRPC interop tests #24824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/Grpc/test/InteropTests/InteropTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
<PropertyGroup>
<ContainsFunctionalTestAssets>true</ContainsFunctionalTestAssets>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>

<!-- https://github.com/dotnet/aspnetcore/issues/24182 -->
<BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/Grpc/test/testassets/InteropClient/InteropClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
using Google.Protobuf;
using Grpc.Auth;
using Grpc.Core;
using Grpc.Core.Utils;
using Grpc.Net.Client;
using Grpc.Testing;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -96,11 +95,12 @@ private InteropClient(ClientOptions options)
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
});
});

Expand Down
4 changes: 4 additions & 0 deletions src/Grpc/test/testassets/InteropClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#endregion

using System;
using System.Reflection;

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

var runtimeVersion = typeof(object).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown";
Console.WriteLine($"NetCoreAppVersion: {runtimeVersion}");

InteropClient.Run(args);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Grpc/test/testassets/InteropWebsite/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(builder =>
{
builder.AddSimpleConsole(o => o.DisableColors = true);
builder.AddConsole();
builder.SetMinimumLevel(LogLevel.Trace);
})
.ConfigureWebHostDefaults(webBuilder =>
Expand Down
9 changes: 8 additions & 1 deletion src/Grpc/test/testassets/InteropWebsite/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#endregion

using System;
using System.Reflection;
using Grpc.Testing;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
Expand All @@ -37,7 +38,13 @@ public void ConfigureServices(IServiceCollection services)
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 =>
Expand Down
4 changes: 2 additions & 2 deletions src/Shared/Process/ProcessEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ public void WaitForExit(bool assertSuccess, TimeSpan? timeSpan = null)
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()
Expand Down