From 3896fc72424e9a44a19be584c6d9b379b120e978 Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Wed, 14 Nov 2018 10:48:12 -0800 Subject: [PATCH 1/2] Cleanup process (#3300) --- .../Docker.cs | 25 ++++++++++--------- .../Docker.cs | 25 ++++++++++--------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/test/Microsoft.AspNetCore.SignalR.Redis.Tests/Docker.cs b/test/Microsoft.AspNetCore.SignalR.Redis.Tests/Docker.cs index ff38d1b5de..cf25fcc393 100644 --- a/test/Microsoft.AspNetCore.SignalR.Redis.Tests/Docker.cs +++ b/test/Microsoft.AspNetCore.SignalR.Redis.Tests/Docker.cs @@ -149,18 +149,21 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests { var (process, lines) = RunProcess(fileName, arguments, prefix, logger); - if (!process.WaitForExit((int)timeout.TotalMilliseconds)) + using (process) { - process.Close(); - logger.LogError("Closing process '{processName}' because it is running longer than the configured timeout.", fileName); + if (!process.WaitForExit((int)timeout.TotalMilliseconds)) + { + process.Close(); + logger.LogError("Closing process '{processName}' because it is running longer than the configured timeout.", fileName); + } + + // Need to WaitForExit without a timeout to guarantee the output stream has written everything + process.WaitForExit(); + + output = string.Join(Environment.NewLine, lines); + + return process.ExitCode; } - - // Need to WaitForExit without a timeout to guarantee the output stream has written everything - process.WaitForExit(); - - output = string.Join(Environment.NewLine, lines); - - return process.ExitCode; } private static (Process, ConcurrentQueue) RunProcess(string fileName, string arguments, string prefix, ILogger logger) @@ -179,9 +182,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests EnableRaisingEvents = true }; - var exitCode = 0; var lines = new ConcurrentQueue(); - process.Exited += (_, __) => exitCode = process.ExitCode; process.OutputDataReceived += (_, a) => { LogIfNotNull(logger.LogInformation, $"'{prefix}' stdout: {{0}}", a.Data); diff --git a/test/Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests/Docker.cs b/test/Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests/Docker.cs index cd79c35c77..6286ad39e8 100644 --- a/test/Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests/Docker.cs +++ b/test/Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests/Docker.cs @@ -149,18 +149,21 @@ namespace Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests { var (process, lines) = RunProcess(fileName, arguments, prefix, logger); - if (!process.WaitForExit((int)timeout.TotalMilliseconds)) + using (process) { - process.Close(); - logger.LogError("Closing process '{processName}' because it is running longer than the configured timeout.", fileName); + if (!process.WaitForExit((int)timeout.TotalMilliseconds)) + { + process.Close(); + logger.LogError("Closing process '{processName}' because it is running longer than the configured timeout.", fileName); + } + + // Need to WaitForExit without a timeout to guarantee the output stream has written everything + process.WaitForExit(); + + output = string.Join(Environment.NewLine, lines); + + return process.ExitCode; } - - // Need to WaitForExit without a timeout to guarantee the output stream has written everything - process.WaitForExit(); - - output = string.Join(Environment.NewLine, lines); - - return process.ExitCode; } private static (Process, ConcurrentQueue) RunProcess(string fileName, string arguments, string prefix, ILogger logger) @@ -179,9 +182,7 @@ namespace Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests EnableRaisingEvents = true }; - var exitCode = 0; var lines = new ConcurrentQueue(); - process.Exited += (_, __) => exitCode = process.ExitCode; process.OutputDataReceived += (_, a) => { LogIfNotNull(logger.LogInformation, $"'{prefix}' stdout: {{0}}", a.Data); From 7e96a029756079d0f978f51bf2ceb34b0b366d65 Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Wed, 14 Nov 2018 10:48:26 -0800 Subject: [PATCH 2/2] Skip cert errors on Chromium too (#3299) --- clients/ts/FunctionalTests/scripts/karma.local.conf.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/clients/ts/FunctionalTests/scripts/karma.local.conf.js b/clients/ts/FunctionalTests/scripts/karma.local.conf.js index fdcb9b779b..4487671000 100644 --- a/clients/ts/FunctionalTests/scripts/karma.local.conf.js +++ b/clients/ts/FunctionalTests/scripts/karma.local.conf.js @@ -41,7 +41,7 @@ try { // We use the launchers themselves to figure out if the browser exists. It's a bit sneaky, but it works. tryAddBrowser("ChromeHeadlessNoSandbox", new ChromeHeadlessBrowser(() => { }, {})); - tryAddBrowser("ChromiumHeadless", new ChromiumHeadlessBrowser(() => { }, {})); + tryAddBrowser("ChromiumHeadlessIgnoreCert", new ChromiumHeadlessBrowser(() => { }, {})); tryAddBrowser("FirefoxHeadless", new FirefoxHeadlessBrowser(0, () => { }, {})); // We need to receive an argument from the caller, but globals don't seem to work, so we use an environment variable. @@ -60,6 +60,12 @@ try { // Ignore cert errors to allow our test cert to work (NEVER do this outside of testing) // ChromeHeadless runs about 10x slower on Windows 7 machines without the --proxy switches below. Why? ¯\_(ツ)_/¯ flags: ["--no-sandbox", "--proxy-server='direct://'", "--proxy-bypass-list=*", "--allow-insecure-localhost", "--ignore-certificate-errors"] + }, + ChromiumHeadlessIgnoreCert: { + base: 'ChromiumHeadless', + + // Ignore cert errors to allow our test cert to work (NEVER do this outside of testing) + flags: ["--allow-insecure-localhost", "--ignore-certificate-errors"] } }, });