Skip to content

Commit

Permalink
Delete unnecessary recover error test
Browse files Browse the repository at this point in the history
The test removed in this commit expects that using an invalid recovery
key leads to an ERROR protocol message being returned which thus fails
the connection, but this isn't part of the spec, we make no guarantee
that invalid recovery keys are rejected, and in fact returning a
CONNECTED protocol message with the error field indicating the recovery
key was invalid is a perfectly good response, which is in fact what we
will start to do in the future.

The functionality that an ERROR protocol message is treated as fatal
and fails the connection is still tested elsewhere, so rmeoving this
test doesn't materially reduce the amount of test coverage.

Signed-off-by: Lewis Marshall <[email protected]>
  • Loading branch information
lmars committed Aug 13, 2024
1 parent 092240b commit 3c10353
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions src/IO.Ably.Tests.Shared/Realtime/ConnectionSandBoxSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1119,37 +1119,6 @@ public async Task WithDummyRecoverData_ShouldConnectAndSetAReasonOnTheConnection
client.Connection.ErrorReason.Code.Should().Be(ErrorCodes.InvalidFormatForConnectionId);
}

[Theory]
[ProtocolData]
[Trait("spec", "RTN16l")]
[Trait("spec", "RTN15c4")]
public async Task WithInvalidRecoverData_ShouldFailAndSetAReasonOnTheConnection(Protocol protocol)
{
var client = await GetRealtimeClient(protocol, (opts, _) =>
{
opts.Recover = "{\"connectionKey\":\"random_key\",\"msgSerial\":5,\"channelSerials\":{\"channel1\":\"98\",\"channel2\":\"32\",\"channel3\":\"09\"}}";
opts.AutoConnect = false;
});

ErrorInfo err = null;
client.Connection.On((args) =>
{
err = args.Reason;
if (args.Current == ConnectionState.Failed)
{
ResetEvent.Set();
}
});
client.Connect();

var result = ResetEvent.WaitOne(10000);
result.Should().BeTrue("Timeout");
err.Should().NotBeNull();
err.Code.Should().Be(ErrorCodes.InvalidFormatForConnectionId);
client.Connection.ErrorReason.Code.Should().Be(ErrorCodes.InvalidFormatForConnectionId);
client.Connection.State.Should().Be(ConnectionState.Failed);
}

[Theory]
[ProtocolData]
[Trait("issue", "65")]
Expand Down

0 comments on commit 3c10353

Please sign in to comment.