Merge pull request #201 from dotnet-maestro-bot/merge/release/2.2-to-master

[automated] Merge branch 'release/2.2' => 'master'
This commit is contained in:
Pranav K 2018-11-09 11:38:35 -08:00 committed by GitHub
commit 808bf234b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 8 deletions

View File

@ -50,7 +50,7 @@ namespace FunctionalTests
} }
// Act // Act
var result = await ProcessManager.RunProcessAsync(processStartInfo); var result = await ProcessManager.RunProcessAsync(processStartInfo, loggerFactory.CreateLogger("ProcessManager"));
// Assert // Assert
Assert.Success(result); Assert.Success(result);

View File

@ -6,6 +6,7 @@ using System.Diagnostics;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
namespace FunctionalTests namespace FunctionalTests
{ {
@ -13,7 +14,7 @@ namespace FunctionalTests
{ {
private static readonly TimeSpan Timeout = TimeSpan.FromMinutes(3); private static readonly TimeSpan Timeout = TimeSpan.FromMinutes(3);
public static Task<ProcessResult> RunProcessAsync(ProcessStartInfo processStartInfo) public static Task<ProcessResult> RunProcessAsync(ProcessStartInfo processStartInfo, ILogger logger)
{ {
processStartInfo.UseShellExecute = false; processStartInfo.UseShellExecute = false;
processStartInfo.RedirectStandardError = true; processStartInfo.RedirectStandardError = true;
@ -31,6 +32,7 @@ namespace FunctionalTests
process.ErrorDataReceived += Process_ErrorDataReceived; process.ErrorDataReceived += Process_ErrorDataReceived;
process.OutputDataReceived += Process_OutputDataReceived; process.OutputDataReceived += Process_OutputDataReceived;
logger.LogInformation($"Executing command '{process.StartInfo.FileName} {process.StartInfo.Arguments}'");
process.Start(); process.Start();
process.BeginErrorReadLine(); process.BeginErrorReadLine();
process.BeginOutputReadLine(); process.BeginOutputReadLine();
@ -52,7 +54,7 @@ namespace FunctionalTests
// This is a timeout. // This is a timeout.
process.Kill(); process.Kill();
throw new TimeoutException($"command '${process.StartInfo.FileName} {process.StartInfo.Arguments}' timed out after {Timeout}."); throw new TimeoutException($"command '{process.StartInfo.FileName} {process.StartInfo.Arguments}' timed out after {Timeout}.");
}); });
var waitTask = Task.Run(() => var waitTask = Task.Run(() =>
@ -83,6 +85,7 @@ namespace FunctionalTests
void Process_ErrorDataReceived(object sender, DataReceivedEventArgs e) void Process_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{ {
logger.LogInformation(e.Data);
lock (outputLock) lock (outputLock)
{ {
output.AppendLine(e.Data); output.AppendLine(e.Data);
@ -91,6 +94,7 @@ namespace FunctionalTests
void Process_OutputDataReceived(object sender, DataReceivedEventArgs e) void Process_OutputDataReceived(object sender, DataReceivedEventArgs e)
{ {
logger.LogInformation(e.Data);
lock (outputLock) lock (outputLock)
{ {
output.AppendLine(e.Data); output.AppendLine(e.Data);

View File

@ -16,12 +16,17 @@ beforeAll(async () => {
const options = debug ? const options = debug ?
{ headless: false, slowMo: 100 } : { headless: false, slowMo: 100 } :
{ args: ['--no-sandbox'] }; { args: ['--no-sandbox'] };
const label = 'Launch puppeteer ';
try { console.log('Begin launching puppeteer');
browser = await puppeteer.launch(options); console.time(label);
} catch (ex) {
error = ex; try {
} browser = await puppeteer.launch(options);
} catch (ex) {
error = ex;
}
console.timeEnd(label);
}); });
afterAll(async () => { afterAll(async () => {