Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ee0653a9a8 |
@@ -1,4 +1,5 @@
|
||||
using Speckle.Sdk.Api.GraphQL.Enums;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Sdk.Api.GraphQL.Enums;
|
||||
|
||||
namespace Speckle.Sdk.Api.GraphQL.Inputs;
|
||||
|
||||
@@ -38,8 +39,14 @@ public record ModelIngestionCancelledInput(string ingestionId, string projectId,
|
||||
public record ProjectModelIngestionSubscriptionInput(
|
||||
string projectId,
|
||||
ModelIngestionReference ingestionReference,
|
||||
ProjectModelIngestionUpdatedMessageType messageType
|
||||
);
|
||||
[property: JsonIgnore] ProjectModelIngestionUpdatedMessageType messageType
|
||||
)
|
||||
{
|
||||
// The Newtonsoft serializer is setup to handle SCREAMING_CASE enums.
|
||||
// But the API requires the enum to look exactly like they are
|
||||
[JsonProperty(nameof(messageType))]
|
||||
public string serializedType => messageType.ToString();
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// <c>@oneOf</c> i.e. server expects <b>either</b> <paramref name="ingestionId"/> or <paramref name="modelId"/>, but not both.
|
||||
|
||||
@@ -222,14 +222,22 @@ public sealed class SubscriptionResource : IDisposable
|
||||
{
|
||||
//language=graphql
|
||||
const string QUERY = """
|
||||
subscription IngestionUpdated(
|
||||
$input: ProjectModelIngestionSubscriptionInput!
|
||||
) {
|
||||
subscription IngestionUpdated($input: ProjectModelIngestionSubscriptionInput!) {
|
||||
data: projectModelIngestionUpdated(input: $input) {
|
||||
modelIngestion {
|
||||
id
|
||||
createdAt
|
||||
updatedAt
|
||||
modelId
|
||||
cancellationRequested
|
||||
statusData {
|
||||
... on HasModelIngestionStatus {
|
||||
status
|
||||
}
|
||||
... on HasProgressMessage {
|
||||
progressMessage
|
||||
}
|
||||
}
|
||||
}
|
||||
type
|
||||
}
|
||||
|
||||
+4
-2
@@ -11,7 +11,7 @@ namespace Speckle.Sdk.Tests.Integration.API.GraphQL.Resources;
|
||||
public class SubscriptionResourceTests : IAsyncLifetime
|
||||
{
|
||||
#if DEBUG
|
||||
private const int WAIT_PERIOD = 3000; // WSL is slow AF, so for local runs, we're being extra generous
|
||||
private const int WAIT_PERIOD = 4000; // WSL is slow AF, so for local runs, we're being extra generous
|
||||
#else
|
||||
private const int WAIT_PERIOD = 400; // For CI runs, a much smaller wait time is acceptable
|
||||
#endif
|
||||
@@ -143,7 +143,8 @@ public class SubscriptionResourceTests : IAsyncLifetime
|
||||
new(_testModel.id, _testProject.id, "", new(".NET test", "0.0.0", null, null))
|
||||
);
|
||||
TaskCompletionSource<ProjectModelIngestionUpdatedMessage> tcs = new();
|
||||
using var sub = Sut.CreateProjectModelIngestionCancellationRequestedSubscription(_testProject.id, ingestion.id);
|
||||
|
||||
using var sub = Sut.CreateProjectModelIngestionCancellationRequestedSubscription(ingestion.id, _testProject.id);
|
||||
sub.Listeners += (_, message) => tcs.SetResult(message);
|
||||
|
||||
await Task.Delay(WAIT_PERIOD); // Give time to subscription to be setup
|
||||
@@ -153,6 +154,7 @@ public class SubscriptionResourceTests : IAsyncLifetime
|
||||
var subscriptionMessage = await tcs.Task;
|
||||
|
||||
subscriptionMessage.Should().NotBeNull();
|
||||
subscriptionMessage.type.Should().Be(ProjectModelIngestionUpdatedMessageType.cancellationRequested);
|
||||
subscriptionMessage.modelIngestion.id.Should().Be(ingestion.id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user