diff --git a/tests/Tgstation.Server.Tests/Live/MultiServerClient.cs b/tests/Tgstation.Server.Tests/Live/MultiServerClient.cs index 5dbf153d78..9cc8f280b8 100644 --- a/tests/Tgstation.Server.Tests/Live/MultiServerClient.cs +++ b/tests/Tgstation.Server.Tests/Live/MultiServerClient.cs @@ -28,7 +28,7 @@ public MultiServerClient(IRestServerClient restServerClient, IGraphQLServerClien public ValueTask DisposeAsync() => ValueTaskExtensions.WhenAll( RestClient.DisposeAsync(), - GraphQLClient.DisposeAsync()); + GraphQLClient?.DisposeAsync() ?? ValueTask.CompletedTask); public ValueTask Execute( Func restAction, @@ -48,6 +48,11 @@ public ValueTask Execute( where TGraphQLResult : class { var restTask = restAction(RestClient); + if (!UseGraphQL) + { + return (await restTask, null); + } + var graphQLResult = await GraphQLClient.RunOperation(graphQLAction, cancellationToken); graphQLResult.EnsureNoErrors(); @@ -60,6 +65,6 @@ public ValueTask Execute( } public ValueTask Subscribe(Func>> operationExecutor, IObserver> observer, CancellationToken cancellationToken) where TResultData : class - => GraphQLClient.Subscribe(operationExecutor, observer, cancellationToken); + => GraphQLClient?.Subscribe(operationExecutor, observer, cancellationToken) ?? ValueTask.FromResult(new CancellationTokenSource()); } } diff --git a/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs b/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs index 2092e0819f..edd368bec1 100644 --- a/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs +++ b/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs @@ -1930,11 +1930,13 @@ async ValueTask CreateClient( password, cancellationToken: cancellationToken); using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); - graphQLClientTask = graphQLClientFactory.CreateFromLogin( - url, - username, - password, - cancellationToken: cts.Token); + graphQLClientTask = MultiServerClient.UseGraphQL + ? graphQLClientFactory.CreateFromLogin( + url, + username, + password, + cancellationToken: cts.Token) + : ValueTask.FromResult(null); IRestServerClient restClient; try diff --git a/tests/Tgstation.Server.Tests/Live/UsersTest.cs b/tests/Tgstation.Server.Tests/Live/UsersTest.cs index ec6220d8fa..8d918804fe 100644 --- a/tests/Tgstation.Server.Tests/Live/UsersTest.cs +++ b/tests/Tgstation.Server.Tests/Live/UsersTest.cs @@ -48,6 +48,9 @@ await ValueTaskExtensions.WhenAll( await TestPagination(cancellationToken); + if (!MultiServerClient.UseGraphQL) + return; + Assert.IsFalse(observer.Completed); Assert.AreEqual(0U, observer.ErrorCount);