From ba4b3771713d4ca2ff59c3f5bd3f3a380c438384 Mon Sep 17 00:00:00 2001 From: amnon Date: Mon, 19 Aug 2024 05:41:47 +0100 Subject: [PATCH] Delete unnecessary recover error test --- ably/realtime_conn_spec_integration_test.go | 70 +-------------------- 1 file changed, 2 insertions(+), 68 deletions(-) diff --git a/ably/realtime_conn_spec_integration_test.go b/ably/realtime_conn_spec_integration_test.go index 18b47381..ec856fa0 100644 --- a/ably/realtime_conn_spec_integration_test.go +++ b/ably/realtime_conn_spec_integration_test.go @@ -17,9 +17,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/ably/ably-go/ably" "github.com/ably/ably-go/ablytest" - "github.com/stretchr/testify/assert" ) func Test_RTN2_WebsocketQueryParams(t *testing.T) { @@ -1129,73 +1130,6 @@ func TestRealtimeConn_RTN15c7_attached(t *testing.T) { // ablytest.Soon.NoRecv(t, &msg, sub, t.Fatalf) } -func TestRealtimeConn_RTN15c4(t *testing.T) { - - doEOF := make(chan struct{}, 1) - - continueDial := make(chan struct{}, 1) - continueDial <- struct{}{} - app, client := ablytest.NewRealtime( - ably.WithAutoConnect(false), - ably.WithDial(func(protocol string, u *url.URL, timeout time.Duration) (ably.Conn, error) { - <-continueDial - c, err := ably.DialWebsocket(protocol, u, timeout) - return protoConnWithFakeEOF{ - Conn: c, - doEOF: doEOF, - }, err - })) - defer safeclose(t, &closeClient{Closer: ablytest.FullRealtimeCloser(client), skip: []int{http.StatusBadRequest}}, app) - - err := ablytest.Wait(ablytest.ConnWaiter(client, client.Connect, ably.ConnectionEventConnected), nil) - assert.NoError(t, err, "Connect=%s", err) - - channel := client.Channels.Get("channel") - err = channel.Attach(context.Background()) - assert.NoError(t, err) - chanStateChanges := make(ably.ChannelStateChanges, 1) - off := channel.On(ably.ChannelEventFailed, chanStateChanges.Receive) - defer off() - - connStateChanges := make(chan ably.ConnectionStateChange, 16) - client.Connection.OnAll(func(c ably.ConnectionStateChange) { - connStateChanges <- c - }) - - client.Connection.SetKey("wrong-conn-key") // wrong connection key for next resume request - doEOF <- struct{}{} - - var connState ably.ConnectionStateChange - - ablytest.Soon.Recv(t, &connState, connStateChanges, t.Fatalf) - assert.Equal(t, ably.ConnectionStateDisconnected, connState.Current, - "expected transition to %v, got %v", ably.ConnectionStateDisconnected, connState.Current) - - rest, err := ably.NewREST(app.Options()...) - assert.NoError(t, err) - err = rest.Channels.Get("channel").Publish(context.Background(), "name", "data") - assert.NoError(t, err) - - continueDial <- struct{}{} - - ablytest.Soon.Recv(t, &connState, connStateChanges, t.Fatalf) - assert.Equal(t, ably.ConnectionStateConnecting, connState.Current) - - // Connection goes into failed state - ablytest.Soon.Recv(t, &connState, connStateChanges, t.Fatalf) - assert.Equal(t, ably.ConnectionStateFailed, connState.Current) - - // Check channel goes into failed state - var change ably.ChannelStateChange - ablytest.Soon.Recv(t, &change, chanStateChanges, t.Fatalf) - assert.Equal(t, ably.ChannelStateFailed, change.Current) - - reason := client.Connection.ErrorReason() - assert.NotNil(t, reason, "expected reason to be set") - assert.Equal(t, http.StatusBadRequest, reason.StatusCode, - "expected %d got %d", http.StatusBadRequest, reason.StatusCode) -} - func TestRealtimeConn_RTN15d_MessageRecovery(t *testing.T) { doEOF := make(chan struct{}, 1) allowDial := make(chan struct{}, 1)