mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-07-21 04:53:44 +01:00
Regression test for #1065
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -191,6 +192,24 @@ namespace Tgstation.Server.Tests
|
||||
await Task.WhenAny(serverTask, Task.Delay(30000, cancellationToken));
|
||||
Assert.IsTrue(serverTask.IsCompleted);
|
||||
|
||||
// http bind test https://github.com/tgstation/tgstation-server/issues/1065
|
||||
using (var blockingSocket = new Socket(SocketType.Stream, ProtocolType.Tcp))
|
||||
{
|
||||
blockingSocket.Bind(new IPEndPoint(IPAddress.Any, server.Url.Port));
|
||||
try
|
||||
{
|
||||
await server.Run(cancellationToken);
|
||||
Assert.Fail("Expected server task to end with a SocketException");
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
Assert.AreEqual(ex.SocketErrorCode, SocketError.AddressAlreadyInUse);
|
||||
}
|
||||
}
|
||||
|
||||
await Task.WhenAny(serverTask, Task.Delay(30000, cancellationToken));
|
||||
Assert.IsTrue(serverTask.IsCompleted);
|
||||
|
||||
var preStartupTime = DateTimeOffset.Now;
|
||||
|
||||
serverTask = server.Run(cancellationToken);
|
||||
|
||||
Reference in New Issue
Block a user