Fix race in gRPC interop test logging (#21080)
* Remove server-side logging
This commit is contained in:
parent
6e9bc21f3e
commit
241dc6b98e
|
|
@ -3,10 +3,6 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Internal;
|
using Microsoft.AspNetCore.Internal;
|
||||||
|
|
@ -19,7 +15,6 @@ namespace InteropTests.Helpers
|
||||||
private readonly Process _process;
|
private readonly Process _process;
|
||||||
private readonly ProcessEx _processEx;
|
private readonly ProcessEx _processEx;
|
||||||
private readonly TaskCompletionSource<object> _startTcs;
|
private readonly TaskCompletionSource<object> _startTcs;
|
||||||
private readonly StringBuilder _consoleOut = new StringBuilder();
|
|
||||||
private static readonly Regex NowListeningRegex = new Regex(@"^\s*Now listening on: .*:(?<port>\d*)$");
|
private static readonly Regex NowListeningRegex = new Regex(@"^\s*Now listening on: .*:(?<port>\d*)$");
|
||||||
|
|
||||||
public string ServerPort { get; private set; }
|
public string ServerPort { get; private set; }
|
||||||
|
|
@ -58,7 +53,6 @@ namespace InteropTests.Helpers
|
||||||
var data = e.Data;
|
var data = e.Data;
|
||||||
if (data != null)
|
if (data != null)
|
||||||
{
|
{
|
||||||
_consoleOut.AppendLine(data);
|
|
||||||
var m = NowListeningRegex.Match(data);
|
var m = NowListeningRegex.Match(data);
|
||||||
if (m.Success)
|
if (m.Success)
|
||||||
{
|
{
|
||||||
|
|
@ -74,19 +68,6 @@ namespace InteropTests.Helpers
|
||||||
|
|
||||||
public void Dispose()
|
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();
|
_processEx.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using InteropTests.Helpers;
|
using InteropTests.Helpers;
|
||||||
using Microsoft.AspNetCore.Testing;
|
using Microsoft.AspNetCore.Testing;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue