Make TCs use rotating TCP ports from ephemeral range only to reduce failures which might be due to overallocated ports

This commit is contained in:
Christian Köllner 2019-08-21 21:42:32 +02:00
parent 44d160b5d1
commit 0ef76806d6
4 changed files with 20 additions and 4 deletions

View File

@ -14,7 +14,7 @@ namespace Capnp.Net.Runtime.Tests
[TestClass]
public class TcpRpc
{
public static int TcpPort = 33444;
public static int TcpPort = 49153;
(TcpRpcServer, TcpRpcClient) SetupClientServerPair()
{

View File

@ -95,6 +95,15 @@ namespace Capnp.Net.Runtime.Tests
Assert.AreEqual(expected, line.Result);
}
[TestInitialize]
public void PrepareNextTest()
{
if (++TcpPort >= 65534)
{
TcpPort = 49152;
}
}
[TestMethod, Timeout(10000)]
public void BasicClient()
{
@ -980,7 +989,7 @@ namespace Capnp.Net.Runtime.Tests
LaunchCompatTestProcess("server:MoreStuff", EmbargoErrorImpl);
}
[TestMethod, Timeout(60000)]
[TestMethod, Timeout(120000)]
public void RepeatedEmbargoError()
{
LaunchCompatTestProcess("server:MoreStuff", stdout =>

View File

@ -13,11 +13,18 @@ namespace Capnp.Net.Runtime.Tests
{
public class TestBase
{
public static int TcpPort = 33444;
public static int TcpPort = 49152;
public static int MediumNonDbgTimeout => Debugger.IsAttached ? Timeout.Infinite : 5000;
public static int LargeNonDbgTimeout => Debugger.IsAttached ? Timeout.Infinite : 10000;
public static int ShortTimeout => 500;
public static int GetNextTcpPort()
{
if (++TcpPort == 65535)
TcpPort = 49152;
return TcpPort;
}
protected ILogger Logger { get; set; }
protected TcpRpcClient SetupClient() => new TcpRpcClient("localhost", TcpPort);

View File

@ -1413,7 +1413,7 @@ int main(int argc, const char* argv[])
return 2;
}
capnp::EzRpcServer server(mainInterface, argv[2], 33444);
capnp::EzRpcServer server(mainInterface, argv[2], 0);
auto& waitScope = server.getWaitScope();
uint port = server.getPort().wait(waitScope);