fix concurrent tests 2 - This should wait for cancellation to happen (#316)

* Fix test to be deterministic

* This should wait for cancellation to happen

* update csharpier
This commit is contained in:
Adam Hathcock
2025-05-30 15:17:04 +01:00
committed by GitHub
parent b652ffa773
commit 422403d499
4 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "1.0.1",
"version": "1.0.2",
"commands": [
"csharpier"
],
@@ -36,7 +36,7 @@ public class AdditionalCancellationTests
);
var task = serializeProcess.Serialize(testClass);
cancellationSource.Cancel();
await cancellationSource.CancelAsync();
var ex = await Assert.ThrowsAsync<OperationCanceledException>(async () => await task);
await Verify(ex);
@@ -64,7 +64,7 @@ public class AdditionalCancellationTests
tasks.Add(serializeProcess.Serialize(i % 2 == 0 ? testClass1 : testClass2));
}
cancellationSource.Cancel();
await cancellationSource.CancelAsync();
while (tasks.Count != 0)
{
@@ -94,7 +94,7 @@ public class AdditionalCancellationTests
);
await serializeProcess.Serialize(testClass);
cancellationSource.Cancel(); // Cancel after completion
await cancellationSource.CancelAsync();
cancellationSource.IsCancellationRequested.Should().BeTrue();
}
@@ -118,7 +118,8 @@ public class ProjectResourceExceptionalTests : IAsyncLifetime
{
ProjectUpdateRoleInput input = new(_secondUser.Account.id.NotNull(), "NonExistentProject", newRole);
var ex = await Assert.ThrowsAsync<AggregateException>(async () => _ = await _unauthedUser.Project.UpdateRole(input)
var ex = await Assert.ThrowsAsync<AggregateException>(async () =>
_ = await _unauthedUser.Project.UpdateRole(input)
);
ex.InnerExceptions.Single().Should().BeOfType<SpeckleGraphQLForbiddenException>();
}
@@ -36,7 +36,8 @@ public class SpeckleHttpTests : MoqTest
var uri = new Uri("https://speckle.xyz");
mockHttp.When(uri.AbsoluteUri).Respond(HttpStatusCode.Unauthorized);
await Assert.ThrowsAsync<HttpRequestException>(async () => await speckleHttp.HttpPing(uri, mockHttp.ToHttpClient())
await Assert.ThrowsAsync<HttpRequestException>(async () =>
await speckleHttp.HttpPing(uri, mockHttp.ToHttpClient())
);
}