diff --git a/src/NexNet.IntegrationTests/BasePipeTests.cs b/src/NexNet.IntegrationTests/BasePipeTests.cs index 0332de06..ee27aa92 100644 --- a/src/NexNet.IntegrationTests/BasePipeTests.cs +++ b/src/NexNet.IntegrationTests/BasePipeTests.cs @@ -21,7 +21,7 @@ TaskCompletionSource tcs var (server, sNexus, client, cNexus) = CreateServerClient( CreateServerConfig(type, log), CreateClientConfig(type, log)); - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); return (server, sNexus, client, cNexus, tcs); } diff --git a/src/NexNet.IntegrationTests/NexusClientTests.cs b/src/NexNet.IntegrationTests/NexusClientTests.cs index 95289275..945df131 100644 --- a/src/NexNet.IntegrationTests/NexusClientTests.cs +++ b/src/NexNet.IntegrationTests/NexusClientTests.cs @@ -26,7 +26,7 @@ public async Task NexusFiresOnConnected(Type type) return ValueTask.CompletedTask; }; - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); await tcs.Task.Timeout(1); @@ -47,7 +47,7 @@ public async Task ConnectsToServer(Type type) clientConfig.InternalOnClientConnect = () => tcs.SetResult(); - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); await tcs.Task.Timeout(1); @@ -95,7 +95,7 @@ public async Task ConnectsAndDisconnectsMultipleTimesFromServer(Type type) CreateServerConfig(type), CreateClientConfig(type)); - await server.StartAsync(); + await server.StartAsync().Timeout(1); for (int i = 0; i < 5; i++) { @@ -131,7 +131,7 @@ public async Task ClientProvidesAuthenticationToken(Type type) CreateServerConfig(type), clientConfig); - await server.StartAsync(); + await server.StartAsync().Timeout(1); clientConfig.Authenticate = () => new byte[] { 123 }; clientConfig.InternalOnSend= (_, bytes) => @@ -164,7 +164,7 @@ public async Task ClientSendsPing(Type type) CreateServerConfig(type), clientConfig); - await server.StartAsync(); + await server.StartAsync().Timeout(1); clientConfig.InternalOnSend = (_, bytes) => { @@ -197,7 +197,7 @@ public async Task ClientResumePingOnDisconnect(Type type) tcs.SetResult(); }; - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); await client.DisconnectAsync().Timeout(1); @@ -229,14 +229,14 @@ public async Task ReconnectsOnDisconnect(Type type) serverConfig.InternalNoLingerOnShutdown = true; serverConfig.InternalForceDisableSendingDisconnectSignal = true; - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); await server.StopAsync(); // Wait for the client to process the disconnect. await Task.Delay(50); - await server.StartAsync(); + await server.StartAsync().Timeout(1); await tcs.Task.Timeout(5); } @@ -266,7 +266,7 @@ public async Task ReconnectsOnTimeout(Type type) clientConfig.PingInterval = 75; clientConfig.Timeout = 50; - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); await tcs.Task.Timeout(1); @@ -293,7 +293,7 @@ public async Task ReconnectsNotifiesReconnecting(Type type) serverConfig.InternalNoLingerOnShutdown = true; serverConfig.InternalForceDisableSendingDisconnectSignal = true; - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); await server.StopAsync(); @@ -328,7 +328,7 @@ public async Task ReconnectsStopsAfterSpecifiedTimes(Type type) serverConfig.InternalNoLingerOnShutdown = true; serverConfig.InternalForceDisableSendingDisconnectSignal = true; - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); await Task.Delay(100); @@ -371,7 +371,7 @@ public async Task ClientProxyInvocationCancelsOnDisconnect(Type type) } }; - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); await Task.Delay(100); @@ -389,7 +389,7 @@ public async Task ReadyTaskCompletesUponConnection(Type type) CreateServerConfig(type), CreateClientConfig(type)); - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); } @@ -414,7 +414,7 @@ public async Task ReadyTaskCompletesUponAuthentication(Type type) return ValueTask.FromResult(new DefaultIdentity()); }; - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); Assert.IsTrue(authCompleted); @@ -435,7 +435,7 @@ public async Task ReadyTaskCompletesUponAuthFailure(Type type) serverHub.OnAuthenticateEvent = hub => ValueTask.FromResult(null); - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); Assert.AreEqual(ConnectionState.Disconnected, client.State); @@ -453,7 +453,7 @@ public async Task DisconnectTaskCompletesUponDisconnection(Type type) serverHub.OnAuthenticateEvent = hub => ValueTask.FromResult(null); - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); var disconnectTask = client.DisconnectedTask; @@ -479,7 +479,7 @@ public async Task DisconnectTaskCompletesUponAuthFailure(Type type) serverHub.OnAuthenticateEvent = hub => ValueTask.FromResult(null); - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); await client.DisconnectedTask.Timeout(1); @@ -498,7 +498,7 @@ public async Task DisconnectTaskCompletesAfterDisconnect(Type type) serverHub.OnAuthenticateEvent = hub => ValueTask.FromResult(null); - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); await server.StopAsync(); diff --git a/src/NexNet.IntegrationTests/NexusClientTests_Cancellation.cs b/src/NexNet.IntegrationTests/NexusClientTests_Cancellation.cs index dbf54fe5..bd361ed7 100644 --- a/src/NexNet.IntegrationTests/NexusClientTests_Cancellation.cs +++ b/src/NexNet.IntegrationTests/NexusClientTests_Cancellation.cs @@ -156,7 +156,7 @@ private async Task ClientSendsMessage(Type type, Action se setup.Invoke(serverNexus); - await server.StartAsync(); + await server.StartAsync().Timeout(1); clientConfig.InternalOnSend = (_, bytes) => { diff --git a/src/NexNet.IntegrationTests/NexusClientTests_InvalidInvocations.cs b/src/NexNet.IntegrationTests/NexusClientTests_InvalidInvocations.cs index 9003ed15..f3c27b9f 100644 --- a/src/NexNet.IntegrationTests/NexusClientTests_InvalidInvocations.cs +++ b/src/NexNet.IntegrationTests/NexusClientTests_InvalidInvocations.cs @@ -16,7 +16,7 @@ public async Task ClientThrowsWhenArgumentTooLarge(Type type) CreateServerConfig(type), CreateClientConfig(type)); - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); var data = new byte[65521]; diff --git a/src/NexNet.IntegrationTests/NexusClientTests_NexusDuplexPipe.cs b/src/NexNet.IntegrationTests/NexusClientTests_NexusDuplexPipe.cs index 62f93159..aa3ddabd 100644 --- a/src/NexNet.IntegrationTests/NexusClientTests_NexusDuplexPipe.cs +++ b/src/NexNet.IntegrationTests/NexusClientTests_NexusDuplexPipe.cs @@ -350,7 +350,7 @@ public async Task Client_PipeNotifiesWhenReady(Type type) [TestCase(Type.Quic)] public async Task Client_PipeReadyCancelsOnDisconnection(Type type) { - var (server, _, client, _, _) = await Setup(type, true); + var (server, _, client, _, _) = await Setup(type); var pipe = client.CreatePipe(); diff --git a/src/NexNet.IntegrationTests/NexusClientTests_ReceiveInvocation.cs b/src/NexNet.IntegrationTests/NexusClientTests_ReceiveInvocation.cs index f2f353cc..9751f105 100644 --- a/src/NexNet.IntegrationTests/NexusClientTests_ReceiveInvocation.cs +++ b/src/NexNet.IntegrationTests/NexusClientTests_ReceiveInvocation.cs @@ -272,7 +272,7 @@ private async Task ClientReceivesInvocation(Type type, Action { diff --git a/src/NexNet.IntegrationTests/NexusServerTests.cs b/src/NexNet.IntegrationTests/NexusServerTests.cs index 923513c7..684b2452 100644 --- a/src/NexNet.IntegrationTests/NexusServerTests.cs +++ b/src/NexNet.IntegrationTests/NexusServerTests.cs @@ -20,7 +20,7 @@ public async Task AcceptsClientConnection(Type type) serverConfig.InternalOnConnect = () => tcs.SetResult(); - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); await tcs.Task.Timeout(1); @@ -44,7 +44,7 @@ public async Task NexusFiresOnConnected(Type type) return ValueTask.CompletedTask; }; - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); @@ -68,7 +68,7 @@ public async Task StartsAndStopsMultipleTimes(Type type) for (int i = 0; i < 5; i++) { - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); @@ -93,7 +93,7 @@ public async Task StopsAndReleasesStoppedTcs(Type type) Assert.IsNull(server.StoppedTask); - await server.StartAsync(); + await server.StartAsync().Timeout(1); Assert.IsFalse(server.StoppedTask!.IsCompleted); await server.StopAsync(); diff --git a/src/NexNet.IntegrationTests/NexusServerTests_Cancellation.cs b/src/NexNet.IntegrationTests/NexusServerTests_Cancellation.cs index 5fc408b5..094a9ab2 100644 --- a/src/NexNet.IntegrationTests/NexusServerTests_Cancellation.cs +++ b/src/NexNet.IntegrationTests/NexusServerTests_Cancellation.cs @@ -155,7 +155,7 @@ private async Task ServerSendsMessage(Type type, Action se setup.Invoke(clientNexus); - await server.StartAsync(); + await server.StartAsync().Timeout(1); serverConfig.InternalOnSend = (_, bytes) => { diff --git a/src/NexNet.IntegrationTests/NexusServerTests_NexusDuplexPipe.cs b/src/NexNet.IntegrationTests/NexusServerTests_NexusDuplexPipe.cs index bcf9d5a8..0f02894e 100644 --- a/src/NexNet.IntegrationTests/NexusServerTests_NexusDuplexPipe.cs +++ b/src/NexNet.IntegrationTests/NexusServerTests_NexusDuplexPipe.cs @@ -16,7 +16,7 @@ public async Task Server_PipeReaderReceivesDataMultipleTimes(Type type) int count = 0; // Ensure that the ids will properly wrap around. - const int iterations = 400; + const int iterations = 20; sNexus.ServerTaskValueWithDuplexPipeEvent = async (nexus, pipe) => { var result = await pipe.Input.ReadAsync(); diff --git a/src/NexNet.IntegrationTests/NexusServerTests_NexusInvocations.cs b/src/NexNet.IntegrationTests/NexusServerTests_NexusInvocations.cs index b464e9bf..d5c0baaf 100644 --- a/src/NexNet.IntegrationTests/NexusServerTests_NexusInvocations.cs +++ b/src/NexNet.IntegrationTests/NexusServerTests_NexusInvocations.cs @@ -19,7 +19,7 @@ public async Task InvokesViaNexusContext(Type type) #pragma warning disable CS1998 clientNexus.ClientTaskEvent = async _ => tcs.SetResult(); #pragma warning restore CS1998 - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); using var context = server.GetContext(); @@ -51,7 +51,7 @@ public async Task InvokesViaNexusContextAndDoesNotBlock(Type type) return ValueTask.CompletedTask; }; - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); using var context = server.GetContext(); @@ -95,7 +95,7 @@ public async Task InvokesViaNexusAndDoesNotBlock(Type type) completed = true; }; - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); @@ -115,7 +115,7 @@ public async Task InvokesViaNexusContextAndGetsReturnFromSingleClient(Type type) clientNexus.ClientTaskValueEvent = _ => ValueTask.FromResult(54321); - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client.ConnectAsync().Timeout(1); using var context = server.GetContext(); @@ -153,7 +153,7 @@ public async Task NexusInvokesOnAll(Type type) clientNexus1.ClientTaskEvent = async _ => tcs1.TrySetResult(); clientNexus2.ClientTaskEvent = async _ => tcs2.TrySetResult(); #pragma warning restore CS1998 - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client1.ConnectAsync().Timeout(1); await client2.ConnectAsync().Timeout(1); @@ -190,7 +190,7 @@ public async Task NexusInvokesOnGroup(Type type) clientNexus1.ClientTaskEvent = async _ => tcs1.TrySetResult(); clientNexus2.ClientTaskEvent = async _ => tcs2.TrySetResult(); #pragma warning restore CS1998 - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client1.ConnectAsync().Timeout(1); await client2.ConnectAsync().Timeout(1); @@ -230,7 +230,7 @@ public async Task NexusInvokesOnGroups(Type type) clientNexus1.ClientTaskEvent = async _ => tcs1.TrySetResult(); clientNexus2.ClientTaskEvent = async _ => tcs2.TrySetResult(); #pragma warning restore CS1998 - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client1.ConnectAsync().Timeout(1); await client2.ConnectAsync().Timeout(1); @@ -269,7 +269,7 @@ public async Task NexusInvokesOnOthers(Type type) clientNexus1.ClientTaskEvent = async _ => invocationCount++; clientNexus2.ClientTaskEvent = async _ => invocationCount++; #pragma warning restore CS1998 - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client1.ConnectAsync().Timeout(1); await client2.ConnectAsync().Timeout(1); @@ -309,7 +309,7 @@ public async Task NexusInvokesOnClient(Type type) clientNexus1.ClientTaskEvent = async _ => invocationCount++; clientNexus2.ClientTaskEvent = async _ => invocationCount++; #pragma warning restore CS1998 - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client1.ConnectAsync().Timeout(1); await client2.ConnectAsync().Timeout(1); @@ -349,7 +349,7 @@ public async Task NexusInvokesOnClients(Type type) clientNexus1.ClientTaskEvent = async _ => tcs1.TrySetResult(); clientNexus2.ClientTaskEvent = async _ => tcs2.TrySetResult(); #pragma warning restore CS1998 - await server.StartAsync(); + await server.StartAsync().Timeout(1); await client1.ConnectAsync().Timeout(1); await client2.ConnectAsync().Timeout(1); diff --git a/src/NexNet.IntegrationTests/NexusServerTests_ReceiveInvocation.cs b/src/NexNet.IntegrationTests/NexusServerTests_ReceiveInvocation.cs index 0b643a06..f0af260f 100644 --- a/src/NexNet.IntegrationTests/NexusServerTests_ReceiveInvocation.cs +++ b/src/NexNet.IntegrationTests/NexusServerTests_ReceiveInvocation.cs @@ -294,7 +294,7 @@ private async Task ServerReceivesInvocation(Type type, Action {