You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by hg...@apache.org on 2026/10/16 18:15:58 UTC
(iggy) 08/16: test(csharp): align TLS and cancellation checks with recovery rules
This is an automated email from the ASF dual-hosted git repository.
hubcio pushed a commit to branch feat/sdk-partition-routing
in repository https://gitbox.apache.org/repos/asf/iggy.git
commit b6702558c31e584387d21adf5e049c19c5fee6e0
Author: Hubert Gruszecki <h....@gmail.com>
AuthorDate: Thu Oct 15 21:28:09 2026 +0200
test(csharp): align TLS and cancellation checks with recovery rules
A dropped registration reply has an unknown outcome, while canceling
an in-flight Next poll can leave a cursor advance uncertain.
Assert the typed TLS failure and cancel cleanly after a yielded
message so the cancellation test has a deterministic boundary.
---
.../IggyTlsConnectionTests.cs | 9 +++++----
.../IggyTypedConsumerTests.cs | 20 +++++++++-----------
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/foreign/csharp/Iggy_SDK.Tests.Integration/IggyTlsConnectionTests.cs b/foreign/csharp/Iggy_SDK.Tests.Integration/IggyTlsConnectionTests.cs
index e5ac343f3..03bfa37f8 100644
--- a/foreign/csharp/Iggy_SDK.Tests.Integration/IggyTlsConnectionTests.cs
+++ b/foreign/csharp/Iggy_SDK.Tests.Integration/IggyTlsConnectionTests.cs
@@ -67,11 +67,12 @@ public class IggyTlsConnectionTests
ReconnectionSettings = new ReconnectionSettings { Enabled = false }
});
- // Nothing travels at connect time (the roster read is auth-gated away), so the plaintext client
- // only dies against the TLS listener on its first request: the server drops the connection
- // without answering a single byte.
+ // Registration is the first request. The TLS listener closes the plaintext connection
+ // after transmission starts without returning a verdict.
await client.ConnectAsync();
- await Should.ThrowAsync<IggyZeroBytesException>(client.LoginUserAsync("iggy", "iggy"));
+ var error = await Should.ThrowAsync<VsrRequestOutcomeUnknownException>(client.LoginUserAsync("iggy", "iggy"));
+ error.InnerException.ShouldBeAssignableTo<IOException>();
+ error.OperationId.ShouldBeNull();
}
[Test]
diff --git a/foreign/csharp/Iggy_SDK.Tests.Integration/IggyTypedConsumerTests.cs b/foreign/csharp/Iggy_SDK.Tests.Integration/IggyTypedConsumerTests.cs
index 460b1c8ce..cf2799672 100644
--- a/foreign/csharp/Iggy_SDK.Tests.Integration/IggyTypedConsumerTests.cs
+++ b/foreign/csharp/Iggy_SDK.Tests.Integration/IggyTypedConsumerTests.cs
@@ -162,34 +162,32 @@ public class IggyTypedConsumerTests
[Test]
[MethodDataSource<IggyServerFixture>(nameof(IggyServerFixture.ProtocolData))]
- public async Task ReceiveDeserializedAsync_Should_StopCleanly_OnCancellation(Protocol protocol)
+ public async Task ReceiveDeserializedAsync_Should_StopCleanly_WhenCanceledAfterYield(Protocol protocol)
{
var client = await Fixture.CreateAuthenticatedClient(protocol);
var testStream = await CreateTestStreamWithMessages(client, protocol);
var consumerId = protocol == Protocol.Tcp ? 204 : 304;
- IggyConsumer<string> consumer = BuildTypedConsumer(client, testStream, Consumer.New(consumerId),
+ await using IggyConsumer<string> consumer = BuildTypedConsumer(client, testStream, Consumer.New(consumerId),
AutoCommitMode.Disabled, new Utf8StringDeserializer());
await consumer.InitAsync();
- using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(500));
+ using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
+ var receivedCount = 0;
await Should.NotThrowAsync(async () =>
{
- try
- {
- await foreach (ReceivedMessage<string> _ in consumer.ReceiveDeserializedAsync(cts.Token))
- {
- }
- }
- catch (OperationCanceledException)
+ await foreach (ReceivedMessage<string> _ in consumer.ReceiveDeserializedAsync(cts.Token))
{
+ receivedCount++;
+ cts.Cancel();
}
});
- await consumer.DisposeAsync();
+ receivedCount.ShouldBe(1);
+ cts.IsCancellationRequested.ShouldBeTrue();
}
private static IggyConsumer<string> BuildTypedConsumer(IIggyClient client,