internal/jsonrpc2_v2: eliminate most arbitrary timeouts in tests
For golang/go#46047 For golang/go#49387 For golang/go#46520 Change-Id: Ib72863a024d74f45c70a6cb53482cb606510f7e4 Reviewed-on: https://go-review.googlesource.com/c/tools/+/388598 Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> gopls-CI: kokoro <noreply+kokoro@google.com> Auto-Submit: Bryan Mills <bcmills@google.com>
This commit is contained in:
parent
9821e82f8e
commit
8db5747d28
1 changed files with 2 additions and 8 deletions
|
|
@ -28,6 +28,7 @@ func TestIdleTimeout(t *testing.T) {
|
|||
panic("TestIdleTimeout deadlocked")
|
||||
})
|
||||
defer timer.Stop()
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
try := func(d time.Duration) (longEnough bool) {
|
||||
|
|
@ -149,8 +150,7 @@ func (fakeHandler) Handle(ctx context.Context, req *jsonrpc2.Request) (interface
|
|||
|
||||
func TestServe(t *testing.T) {
|
||||
stacktest.NoLeak(t)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
ctx := context.Background()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
|
|
@ -187,7 +187,6 @@ func TestServe(t *testing.T) {
|
|||
}
|
||||
|
||||
func newFake(t *testing.T, ctx context.Context, l jsonrpc2.Listener) (*jsonrpc2.Connection, func(), error) {
|
||||
l = jsonrpc2.NewIdleListener(100*time.Millisecond, l)
|
||||
server, err := jsonrpc2.Serve(ctx, l, jsonrpc2.ConnectionOptions{
|
||||
Handler: fakeHandler{},
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue