Skip to content

Commit a0e9a16

Browse files
committed
fix expected execution time
1 parent 21dbaaf commit a0e9a16

File tree

2 files changed

+7
-5
lines changed
  • tests/GraphQL.Integration.Tests

2 files changed

+7
-5
lines changed

tests/GraphQL.Integration.Tests/QueryAndMutationTests/Base.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,13 @@ query Long {
168168
}");
169169

170170
using (var setup = WebHostHelpers.SetupTest<StartupChat>(false, serializer)) {
171-
var cts = new CancellationTokenSource(TimeSpan.FromSeconds(1));
171+
var cancellationTimeout = TimeSpan.FromSeconds(1);
172+
var cts = new CancellationTokenSource(cancellationTimeout);
172173

173174
Func<Task> requestTask = () => setup.Client.SendQueryAsync(graphQLRequest, () => new {longRunning = string.Empty}, cts.Token);
174175
Action timeMeasurement = () => requestTask.Should().Throw<TaskCanceledException>();
175176

176-
timeMeasurement.ExecutionTime().Should().BeCloseTo(TimeSpan.FromSeconds(2), TimeSpan.FromMilliseconds(200));
177+
timeMeasurement.ExecutionTime().Should().BeCloseTo(cancellationTimeout, TimeSpan.FromMilliseconds(50));
177178
}
178179
}
179180
}

tests/GraphQL.Integration.Tests/WebsocketTests/Base.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,13 @@ query Long {
5959
}");
6060

6161
using (var setup = WebHostHelpers.SetupTest<StartupChat>(true, Serializer)) {
62-
var cts = new CancellationTokenSource(TimeSpan.FromSeconds(1));
62+
var cancellationTimeout = TimeSpan.FromSeconds(1);
63+
var cts = new CancellationTokenSource(cancellationTimeout);
6364

64-
Func<Task> requestTask = () => setup.Client.SendQueryAsync(graphQLRequest, () => new { longRunning = string.Empty }, cts.Token);
65+
Func<Task> requestTask = () => setup.Client.SendQueryAsync(graphQLRequest, () => new {longRunning = string.Empty}, cts.Token);
6566
Action timeMeasurement = () => requestTask.Should().Throw<TaskCanceledException>();
6667

67-
timeMeasurement.ExecutionTime().Should().BeCloseTo(TimeSpan.FromSeconds(2), TimeSpan.FromMilliseconds(200));
68+
timeMeasurement.ExecutionTime().Should().BeCloseTo(cancellationTimeout, TimeSpan.FromMilliseconds(50));
6869
}
6970
}
7071

0 commit comments

Comments
 (0)