Fix flaky tests by increasing the timeout for a task to complete. (#82)
Also realized that the TaskAssert helper class wasn't actually testing anything, so I fixed that. Then I needed to fix another test that wasn't testing correctly.
This commit is contained in:
Родитель
43e3ad97f6
Коммит
5d183b1294
|
@ -349,7 +349,7 @@ namespace Microsoft.VisualStudio.Web.BrowserLink
|
|||
|
||||
_createdAdapter = new MockHttpSocketAdapter();
|
||||
|
||||
return null;
|
||||
return Task.FromResult((IHttpSocketAdapter)null);
|
||||
}
|
||||
|
||||
private Task HandleAsciiResponse(byte[] buffer, int offset, int count)
|
||||
|
|
|
@ -292,7 +292,7 @@ namespace Microsoft.VisualStudio.Web.BrowserLink
|
|||
TaskAssert.NotCompleted(writeTask, "Should be waiting for server to respond");
|
||||
|
||||
// Act II - Wait for the request to time out
|
||||
System.Threading.Thread.Sleep(1100);
|
||||
writeTask.Wait(2000);
|
||||
|
||||
// Assert
|
||||
TaskAssert.Completed(writeTask, "Write should complete when server fails to respond");
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Microsoft.VisualStudio.Web.BrowserLink
|
|||
ThrowFailure(
|
||||
task.Exception,
|
||||
GetMethodFailureMessage(nameof(NotFaulted)),
|
||||
FormatMessage(task.Exception),
|
||||
FormatMessage(task.Exception),
|
||||
FormatMessage(messageFormat, args));
|
||||
}
|
||||
}
|
||||
|
@ -81,15 +81,7 @@ namespace Microsoft.VisualStudio.Web.BrowserLink
|
|||
{
|
||||
exception = UnwrapException(exception);
|
||||
|
||||
// TODO: Add this condition back with the right exception type
|
||||
//if (exception is AssertFailedException)
|
||||
//{
|
||||
// return null;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
return String.Format("{0}: {1}.", exception.GetType().Name, exception.Message);
|
||||
//}
|
||||
return exception.ToString();
|
||||
}
|
||||
|
||||
private static string FormatMessage(string messageFormat, params object[] messageArgs)
|
||||
|
@ -113,22 +105,7 @@ namespace Microsoft.VisualStudio.Web.BrowserLink
|
|||
{
|
||||
string failureMessage = String.Join(" ", failureMessages.Where(x => !String.IsNullOrWhiteSpace(x)));
|
||||
|
||||
if (exception != null)
|
||||
{
|
||||
exception = UnwrapException(exception);
|
||||
|
||||
// TODO: Add this code back with the right exception type
|
||||
//if (exception is AssertFailedException)
|
||||
//{
|
||||
// throw exception;
|
||||
//}
|
||||
|
||||
//throw new AssertFailedException(failureMessage, exception);
|
||||
}
|
||||
else
|
||||
{
|
||||
//throw new AssertFailedException(failureMessage);
|
||||
}
|
||||
Assert.True(false, failureMessage);
|
||||
}
|
||||
|
||||
private static Exception UnwrapException(Exception exception)
|
||||
|
|
Загрузка…
Ссылка в новой задаче