Skip to content

Commit

Permalink
Merge pull request #133 from insolar/PENV-501-connection-refused-in-test
Browse files Browse the repository at this point in the history
PENV-501: connection refused in test
  • Loading branch information
megge-dream authored Jul 31, 2020
2 parents acede22 + f463911 commit 867894a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions testutils/connectionmanager/connectionmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 867894a

Please sign in to comment.