From 208bf0541b658943295be1d99a1cf6e997d38b27 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Fri, 13 Aug 2021 14:17:11 -0400 Subject: [PATCH] add sleep for test context switch --- inspect/inspect.go | 2 -- inspect/inspect_test.go | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/inspect/inspect.go b/inspect/inspect.go index 76b5057cc..d80034119 100644 --- a/inspect/inspect.go +++ b/inspect/inspect.go @@ -3,7 +3,6 @@ package inspect import ( "context" "errors" - "fmt" "net" "sync" @@ -104,7 +103,6 @@ func (inspect *Inspect) Run(ctx context.Context) error { return err } defer func() { - fmt.Println("stopping indexer") err := inspect.indexerService.Stop() if err != nil { inspect.logger.Error("indexer stopped with error", "err", err) diff --git a/inspect/inspect_test.go b/inspect/inspect_test.go index 8c5ec6040..f8ae635c1 100644 --- a/inspect/inspect_test.go +++ b/inspect/inspect_test.go @@ -8,6 +8,7 @@ import ( "strings" "sync" "testing" + "time" "github.com/fortytw2/leaktest" "github.com/stretchr/testify/mock" @@ -81,6 +82,8 @@ func TestInspectServeInfoRPC(t *testing.T) { defer wg.Done() require.NoError(t, d.Run(ctx)) }() + // force context switch + time.Sleep(10 * time.Millisecond) requireConnect(t, rpcConfig.ListenAddress, 15) cli, err := http_client.New(rpcConfig.ListenAddress) require.NoError(t, err)