Skip to content

Commit 241dc6b

Browse files
author
John Luo
authored
Fix race in gRPC interop test logging (dotnet#21080)
* Remove server-side logging
1 parent 6e9bc21 commit 241dc6b

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

src/Grpc/test/InteropTests/Helpers/WebsiteProcess.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33

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

2520
public string ServerPort { get; private set; }
@@ -58,7 +53,6 @@ private void Process_OutputDataReceived(object sender, DataReceivedEventArgs e)
5853
var data = e.Data;
5954
if (data != null)
6055
{
61-
_consoleOut.AppendLine(data);
6256
var m = NowListeningRegex.Match(data);
6357
if (m.Success)
6458
{
@@ -74,19 +68,6 @@ private void Process_OutputDataReceived(object sender, DataReceivedEventArgs e)
7468

7569
public void Dispose()
7670
{
77-
var attributes = Assembly.GetExecutingAssembly()
78-
.GetCustomAttributes<AssemblyMetadataAttribute>();
79-
var serverLogPath = attributes.SingleOrDefault(a => a.Key == "ServerLogPath")?.Value;
80-
if (!string.IsNullOrEmpty(serverLogPath))
81-
{
82-
File.WriteAllText(serverLogPath, _consoleOut.ToString());
83-
}
84-
else
85-
{
86-
var logDir = Path.Combine(Directory.GetCurrentDirectory(), "artifacts", "logs");
87-
Directory.CreateDirectory(logDir);
88-
File.WriteAllText(Path.Combine(logDir, "InteropServer.log"), _consoleOut.ToString());
89-
}
9071
_processEx.Dispose();
9172
}
9273
}

src/Grpc/test/InteropTests/InteropTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Collections.Generic;
66
using System.IO;
77
using System.Linq;
8-
using System.Reflection;
98
using System.Threading.Tasks;
109
using InteropTests.Helpers;
1110
using Microsoft.AspNetCore.Testing;

0 commit comments

Comments
 (0)