Skip to content

Commit

Permalink
Http2.Tests-DevOps (#22)
Browse files Browse the repository at this point in the history
Sometimes DataCompressionHttp2Test unit test fails
  • Loading branch information
cuteant authored Sep 11, 2020
1 parent 8d144cd commit a9eec59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions test/DotNetty.Codecs.Http.Tests/HttpClientCodecTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class ClientHandler : SimpleChannelInboundHandler<IFullHttpResponse>

public bool WaitForCompletion()
{
this.completion.Task.Wait(TimeSpan.FromSeconds(5));
this.completion.Task.Wait(TimeSpan.FromSeconds(10));
return this.completion.Task.Status == TaskStatus.RanToCompletion;
}

Expand All @@ -180,7 +180,7 @@ class ServerHandler : SimpleChannelInboundHandler<IFullHttpRequest>

public bool WaitForCompletion()
{
this.completion.Task.Wait(TimeSpan.FromSeconds(5));
this.completion.Task.Wait(TimeSpan.FromSeconds(10));
return this.completion.Task.Status == TaskStatus.RanToCompletion;
}

Expand All @@ -196,8 +196,8 @@ protected override void ChannelRead0(IChannelHandlerContext ctx, IFullHttpReques
* See <a href="https://tools.ietf.org/html/rfc7230#section-3.3.3">RFC 7230, 3.3.3</a>.
*/

sChannel.WriteAndFlushAsync(Unpooled.WrappedBuffer(Encoding.UTF8.GetBytes("HTTP/1.0 200 OK\r\n" + "Date: Fri, 31 Dec 1999 23:59:59 GMT\r\n" + "Content-Type: text/html\r\n\r\n")));
sChannel.WriteAndFlushAsync(Unpooled.WrappedBuffer(Encoding.UTF8.GetBytes("<html><body>hello half closed!</body></html>\r\n")));
sChannel.WriteAndFlushAsync(Unpooled.WrappedBuffer(Encoding.UTF8.GetBytes("HTTP/1.0 200 OK\r\n" + "Date: Fri, 31 Dec 1999 23:59:59 GMT\r\n" + "Content-Type: text/html\r\n\r\n"))).GetAwaiter().GetResult();
sChannel.WriteAndFlushAsync(Unpooled.WrappedBuffer(Encoding.UTF8.GetBytes("<html><body>hello half closed!</body></html>\r\n"))).GetAwaiter().GetResult();
sChannel.CloseAsync();

sChannel.CloseCompletion.LinkOutcome(this.completion);
Expand Down
10 changes: 5 additions & 5 deletions test/DotNetty.Codecs.Http2.Tests/DataCompressionHttp2Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ public void Dispose()
this.serverConnectedChannel = null;
}
Task.WaitAll(
this.sb.Group().ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(5)),
this.sb.ChildGroup().ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(5)),
this.cb.Group().ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(5)));
this.sb.Group().ShutdownGracefullyAsync(TimeSpan.Zero, TimeSpan.Zero),
this.sb.ChildGroup().ShutdownGracefullyAsync(TimeSpan.Zero, TimeSpan.Zero),
this.cb.Group().ShutdownGracefullyAsync(TimeSpan.Zero, TimeSpan.Zero));

this.serverOut?.Close();
}
Expand Down Expand Up @@ -430,8 +430,8 @@ private void BootstrapEnv(int serverOutSize)
var port = ((IPEndPoint)this.serverChannel.LocalAddress).Port;
var ccf = this.cb.ConnectAsync(loopback, port);
this.clientChannel = ccf.GetAwaiter().GetResult();
Assert.True(prefaceWrittenLatch.Wait(TimeSpan.FromSeconds(5)));
Assert.True(serverChannelLatch.Wait(TimeSpan.FromSeconds(5)));
Assert.True(prefaceWrittenLatch.Wait(TimeSpan.FromSeconds(10)));
Assert.True(serverChannelLatch.Wait(TimeSpan.FromSeconds(10)));
}

sealed class TestChannelHandlerAdapter : ChannelHandlerAdapter
Expand Down

0 comments on commit a9eec59

Please sign in to comment.