Skip to content

Fix race in gRPC interop test logging #21080

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 2 commits into from
Apr 22, 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
19 changes: 0 additions & 19 deletions src/Grpc/test/InteropTests/Helpers/WebsiteProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Internal;
Expand All @@ -19,7 +15,6 @@ public class WebsiteProcess : IDisposable
private readonly Process _process;
private readonly ProcessEx _processEx;
private readonly TaskCompletionSource<object> _startTcs;
private readonly StringBuilder _consoleOut = new StringBuilder();
private static readonly Regex NowListeningRegex = new Regex(@"^\s*Now listening on: .*:(?<port>\d*)$");

public string ServerPort { get; private set; }
Expand Down Expand Up @@ -58,7 +53,6 @@ private void Process_OutputDataReceived(object sender, DataReceivedEventArgs e)
var data = e.Data;
if (data != null)
{
_consoleOut.AppendLine(data);
var m = NowListeningRegex.Match(data);
if (m.Success)
{
Expand All @@ -74,19 +68,6 @@ private void Process_OutputDataReceived(object sender, DataReceivedEventArgs e)

public void Dispose()
{
var attributes = Assembly.GetExecutingAssembly()
.GetCustomAttributes<AssemblyMetadataAttribute>();
var serverLogPath = attributes.SingleOrDefault(a => a.Key == "ServerLogPath")?.Value;
if (!string.IsNullOrEmpty(serverLogPath))
{
File.WriteAllText(serverLogPath, _consoleOut.ToString());
}
else
{
var logDir = Path.Combine(Directory.GetCurrentDirectory(), "artifacts", "logs");
Directory.CreateDirectory(logDir);
File.WriteAllText(Path.Combine(logDir, "InteropServer.log"), _consoleOut.ToString());
}
_processEx.Dispose();
}
}
Expand Down
1 change: 0 additions & 1 deletion src/Grpc/test/InteropTests/InteropTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using InteropTests.Helpers;
using Microsoft.AspNetCore.Testing;
Expand Down