Attempt fix Angular template flaky test (#17279)
* Attempt fix Angular template flaky test * Increase timeout
This commit is contained in:
parent
e2def80a0a
commit
877e5fafef
|
|
@ -164,7 +164,7 @@ namespace Templates.Test.Helpers
|
|||
{
|
||||
if (!_process.HasExited)
|
||||
{
|
||||
throw new InvalidOperationException("Process has not finished running.");
|
||||
throw new InvalidOperationException($"Process {_process.ProcessName} with pid: {_process.Id} has not finished running.");
|
||||
}
|
||||
|
||||
return $"Process exited with code {_process.ExitCode}\nStdErr: {Error}\nStdOut: {Output}";
|
||||
|
|
@ -174,12 +174,16 @@ namespace Templates.Test.Helpers
|
|||
{
|
||||
if(!timeSpan.HasValue)
|
||||
{
|
||||
timeSpan = TimeSpan.FromSeconds(480);
|
||||
timeSpan = TimeSpan.FromSeconds(600);
|
||||
}
|
||||
|
||||
Exited.Wait(timeSpan.Value);
|
||||
|
||||
if (assertSuccess && _process.ExitCode != 0)
|
||||
var exited = Exited.Wait(timeSpan.Value);
|
||||
if (!exited)
|
||||
{
|
||||
_output.WriteLine($"The process didn't exit within the allotted time ({timeSpan.Value.TotalSeconds} seconds).");
|
||||
_process.Dispose();
|
||||
}
|
||||
else if (assertSuccess && _process.ExitCode != 0)
|
||||
{
|
||||
throw new Exception($"Process exited with code {_process.ExitCode}\nStdErr: {Error}\nStdOut: {Output}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ namespace Templates.Test.Helpers
|
|||
do
|
||||
{
|
||||
restoreResult = await RestoreAsync(output, workingDirectory);
|
||||
if (restoreResult.ExitCode == 0)
|
||||
if (restoreResult.HasExited && restoreResult.ExitCode == 0)
|
||||
{
|
||||
return restoreResult;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ namespace Templates.Test.SpaTemplateTest
|
|||
catch (HttpRequestException ex) when (ex.Message.StartsWith("The SSL connection could not be established"))
|
||||
{
|
||||
}
|
||||
await Task.Delay(TimeSpan.FromSeconds(5 * attempt));
|
||||
await Task.Delay(TimeSpan.FromSeconds(10 * attempt));
|
||||
} while (attempt < maxAttempts);
|
||||
}
|
||||
|
||||
|
|
@ -306,10 +306,12 @@ namespace Templates.Test.SpaTemplateTest
|
|||
var entries = logs.GetLog(logKind);
|
||||
var badEntries = entries.Where(e => new LogLevel[] { LogLevel.Warning, LogLevel.Severe }.Contains(e.Level));
|
||||
|
||||
// Based on https://github.com/webpack/webpack-dev-server/issues/2134
|
||||
badEntries = badEntries.Where(e =>
|
||||
!e.Message.Contains("failed: WebSocket is closed before the connection is established.")
|
||||
&& !e.Message.Contains("[WDS] Disconnected!")
|
||||
&& !e.Message.Contains("Timed out connecting to Chrome, retrying"));
|
||||
&& !e.Message.Contains("Timed out connecting to Chrome, retrying")
|
||||
&& !(e.Message.Contains("jsonp?c=") && e.Message.Contains("Uncaught TypeError:") && e.Message.Contains("is not a function")));
|
||||
|
||||
Assert.True(badEntries.Count() == 0, "There were Warnings or Errors from the browser." + Environment.NewLine + string.Join(Environment.NewLine, badEntries));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue