Skip to content

Commit

Permalink
Fix all test flakes, fix compat with opentelemetry 1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rsafonseca committed Jul 25, 2022
1 parent 33c2a72 commit c517e04
Show file tree
Hide file tree
Showing 15 changed files with 1,056 additions and 778 deletions.
2 changes: 1 addition & 1 deletion acceptor/ws_acceptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func mustConnectToWS(t *testing.T, write []byte, w *WSAcceptor, protocol string)
conn.WriteMessage(websocket.BinaryMessage, write)
defer conn.Close()
return err
}, nil, 10*time.Millisecond, 100*time.Millisecond)
}, nil, 30*time.Millisecond, 100*time.Millisecond)
}

func TestWSAcceptorListenAndServe(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions cluster/grpc_rpc_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestBroadcastSessionBind(t *testing.T) {
return g.server.ID, nil
})

mockPitayaClient.EXPECT().SessionBindRemote(gomock.Any(), gomock.Any()).Do(func(ctx context.Context, msg *protos.BindMsg) {
mockPitayaClient.EXPECT().SessionBindRemote(gomock.Any(), gomock.Any()).Do(func(ctx context.Context, msg *protos.BindMsg, opts ...grpc.CallOption) {
assert.Equal(t, uid, msg.Uid, g.server.ID, msg.Fid)
})
}
Expand Down Expand Up @@ -168,7 +168,7 @@ func TestSendKick(t *testing.T) {
return table.sv.ID, nil
})

mockPitayaClient.EXPECT().KickUser(gomock.Any(), gomock.Any()).Do(func(ctx context.Context, msg *protos.KickMsg) {
mockPitayaClient.EXPECT().KickUser(gomock.Any(), gomock.Any()).Do(func(ctx context.Context, msg *protos.KickMsg, opts ...grpc.CallOption) {
assert.Equal(t, table.userID, msg.UserId)
})
}
Expand Down Expand Up @@ -228,14 +228,14 @@ func TestSendPush(t *testing.T) {
return table.sv.ID, nil
})

mockPitayaClient.EXPECT().PushToUser(gomock.Any(), gomock.Any()).Do(func(ctx context.Context, msg *protos.Push) {
mockPitayaClient.EXPECT().PushToUser(gomock.Any(), gomock.Any()).Do(func(ctx context.Context, msg *protos.Push, opts ...grpc.CallOption) {
assert.Equal(t, uid, msg.Uid)
assert.Equal(t, msg.Route, "sv.svc.mth")
assert.Equal(t, msg.Data, []byte{0x01})
})
} else if table.bindingStorage == nil && table.sv.ID != "" {
g.clientMap.Store(table.sv.ID, &grpcClient{connected: true, cli: mockPitayaClient})
mockPitayaClient.EXPECT().PushToUser(gomock.Any(), gomock.Any()).Do(func(ctx context.Context, msg *protos.Push) {
mockPitayaClient.EXPECT().PushToUser(gomock.Any(), gomock.Any()).Do(func(ctx context.Context, msg *protos.Push, opts ...grpc.CallOption) {
assert.Equal(t, uid, msg.Uid)
assert.Equal(t, msg.Route, "sv.svc.mth")
assert.Equal(t, msg.Data, []byte{0x01})
Expand Down
Loading

0 comments on commit c517e04

Please sign in to comment.