Skip to content

Commit f749c38

Browse files
authored
Merge pull request #662 from ably/remove_RTN15c4
Delete unnecessary recover error test
2 parents 26dbcf1 + ba4b377 commit f749c38

File tree

1 file changed

+2
-68
lines changed

1 file changed

+2
-68
lines changed

ably/realtime_conn_spec_integration_test.go

+2-68
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ import (
1717
"testing"
1818
"time"
1919

20+
"github.com/stretchr/testify/assert"
21+
2022
"github.com/ably/ably-go/ably"
2123
"github.com/ably/ably-go/ablytest"
22-
"github.com/stretchr/testify/assert"
2324
)
2425

2526
func Test_RTN2_WebsocketQueryParams(t *testing.T) {
@@ -1129,73 +1130,6 @@ func TestRealtimeConn_RTN15c7_attached(t *testing.T) {
11291130
// ablytest.Soon.NoRecv(t, &msg, sub, t.Fatalf)
11301131
}
11311132

1132-
func TestRealtimeConn_RTN15c4(t *testing.T) {
1133-
1134-
doEOF := make(chan struct{}, 1)
1135-
1136-
continueDial := make(chan struct{}, 1)
1137-
continueDial <- struct{}{}
1138-
app, client := ablytest.NewRealtime(
1139-
ably.WithAutoConnect(false),
1140-
ably.WithDial(func(protocol string, u *url.URL, timeout time.Duration) (ably.Conn, error) {
1141-
<-continueDial
1142-
c, err := ably.DialWebsocket(protocol, u, timeout)
1143-
return protoConnWithFakeEOF{
1144-
Conn: c,
1145-
doEOF: doEOF,
1146-
}, err
1147-
}))
1148-
defer safeclose(t, &closeClient{Closer: ablytest.FullRealtimeCloser(client), skip: []int{http.StatusBadRequest}}, app)
1149-
1150-
err := ablytest.Wait(ablytest.ConnWaiter(client, client.Connect, ably.ConnectionEventConnected), nil)
1151-
assert.NoError(t, err, "Connect=%s", err)
1152-
1153-
channel := client.Channels.Get("channel")
1154-
err = channel.Attach(context.Background())
1155-
assert.NoError(t, err)
1156-
chanStateChanges := make(ably.ChannelStateChanges, 1)
1157-
off := channel.On(ably.ChannelEventFailed, chanStateChanges.Receive)
1158-
defer off()
1159-
1160-
connStateChanges := make(chan ably.ConnectionStateChange, 16)
1161-
client.Connection.OnAll(func(c ably.ConnectionStateChange) {
1162-
connStateChanges <- c
1163-
})
1164-
1165-
client.Connection.SetKey("wrong-conn-key") // wrong connection key for next resume request
1166-
doEOF <- struct{}{}
1167-
1168-
var connState ably.ConnectionStateChange
1169-
1170-
ablytest.Soon.Recv(t, &connState, connStateChanges, t.Fatalf)
1171-
assert.Equal(t, ably.ConnectionStateDisconnected, connState.Current,
1172-
"expected transition to %v, got %v", ably.ConnectionStateDisconnected, connState.Current)
1173-
1174-
rest, err := ably.NewREST(app.Options()...)
1175-
assert.NoError(t, err)
1176-
err = rest.Channels.Get("channel").Publish(context.Background(), "name", "data")
1177-
assert.NoError(t, err)
1178-
1179-
continueDial <- struct{}{}
1180-
1181-
ablytest.Soon.Recv(t, &connState, connStateChanges, t.Fatalf)
1182-
assert.Equal(t, ably.ConnectionStateConnecting, connState.Current)
1183-
1184-
// Connection goes into failed state
1185-
ablytest.Soon.Recv(t, &connState, connStateChanges, t.Fatalf)
1186-
assert.Equal(t, ably.ConnectionStateFailed, connState.Current)
1187-
1188-
// Check channel goes into failed state
1189-
var change ably.ChannelStateChange
1190-
ablytest.Soon.Recv(t, &change, chanStateChanges, t.Fatalf)
1191-
assert.Equal(t, ably.ChannelStateFailed, change.Current)
1192-
1193-
reason := client.Connection.ErrorReason()
1194-
assert.NotNil(t, reason, "expected reason to be set")
1195-
assert.Equal(t, http.StatusBadRequest, reason.StatusCode,
1196-
"expected %d got %d", http.StatusBadRequest, reason.StatusCode)
1197-
}
1198-
11991133
func TestRealtimeConn_RTN15d_MessageRecovery(t *testing.T) {
12001134
doEOF := make(chan struct{}, 1)
12011135
allowDial := make(chan struct{}, 1)

0 commit comments

Comments
 (0)