diff --git a/testutils/connectionmanager/connectionmanager.go b/testutils/connectionmanager/connectionmanager.go index ccf1e90d..d7f01ad9 100644 --- a/testutils/connectionmanager/connectionmanager.go +++ b/testutils/connectionmanager/connectionmanager.go @@ -7,19 +7,21 @@ package connectionmanager import ( "context" + "net" "testing" + "github.com/insolar/insolar/ledger/heavy/exporter" + "github.com/insolar/spec-insolar-block-explorer-api/v1/server" + "github.com/jinzhu/gorm" + "github.com/labstack/echo/v4" + "github.com/stretchr/testify/require" + "github.com/insolar/block-explorer/api" "github.com/insolar/block-explorer/configuration" "github.com/insolar/block-explorer/etl/connection" "github.com/insolar/block-explorer/etl/storage" "github.com/insolar/block-explorer/test/heavymock" "github.com/insolar/block-explorer/testutils" - "github.com/insolar/insolar/ledger/heavy/exporter" - "github.com/insolar/spec-insolar-block-explorer-api/v1/server" - "github.com/jinzhu/gorm" - "github.com/labstack/echo/v4" - "github.com/stretchr/testify/require" ) const DefaultAPIPort = ":8081" @@ -81,6 +83,9 @@ func (c *ConnectionManager) StartAPIServer(t testing.TB) { apiServer := api.NewServer(c.ctx, s, cfg) server.RegisterHandlers(e, apiServer) + l, err := net.Listen("tcp", cfg.Listen) + require.NoError(t, err, "can't start listen") + c.echo.Listener = l go func() { err := c.echo.Start(cfg.Listen) if err != nil {