Flake in example unit tests
tock-ibm opened this issue · comments
They all run on the same port 6001+7001 which creates collisions on certain environments.
Deal unique ports in testServer, _, _, err := util.SetupTestEnv(t, tempDir, uint32(6001))
in every package to avoid collisions.
--- FAIL: TestDataContext_ExecuteTxValidityExample (0.57s)
tx_validity_test.go:20:
Error Trace: tx_validity_test.go:20
Error: Received unexpected error:
listen tcp 127.0.0.1:7001: bind: address already in use
error while creating a tcp listener
github.com/hyperledger-labs/orion-server/internal/comm.(*HTTPTransport).Start
/home/tock/go/pkg/mod/github.com/hyperledger-labs/orion-server@v0.2.0-fix-docker.0.20211123100045-9b59822eb800/internal/comm/httptransport.go:215
github.com/hyperledger-labs/orion-server/internal/bcdb.newTransactionProcessor
/home/tock/go/pkg/mod/github.com/hyperledger-labs/orion-server@v0.2.0-fix-docker.0.20211123100045-9b59822eb800/internal/bcdb/transaction_processor.go:173
github.com/hyperledger-labs/orion-server/internal/bcdb.NewDB
/home/tock/go/pkg/mod/github.com/hyperledger-labs/orion-server@v0.2.0-fix-docker.0.20211123100045-9b59822eb800/internal/bcdb/db.go:256
github.com/hyperledger-labs/orion-server/pkg/server.New
/home/tock/go/pkg/mod/github.com/hyperledger-labs/orion-server@v0.2.0-fix-docker.0.20211123100045-9b59822eb800/pkg/server/server.go:43
github.com/hyperledger-labs/orion-sdk-go/examples/util.SetupTestEnvWithParams
/home/tock/go/src/github.com/hyperledger-labs/orion-sdk-go/examples/util/testutil.go:40
github.com/hyperledger-labs/orion-sdk-go/examples/util.SetupTestEnv
/home/tock/go/src/github.com/hyperledger-labs/orion-sdk-go/examples/util/testutil.go:24
github.com/hyperledger-labs/orion-sdk-go/examples/api/tx_validity.TestDataContext_ExecuteTxValidityExample
/home/tock/go/src/github.com/hyperledger-labs/orion-sdk-go/examples/api/tx_validity/tx_validity_test.go:19
testing.tRunner
/usr/local/go/src/testing/testing.go:1193
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1371
can't initiate tx processor
error while creating the database object
github.com/hyperledger-labs/orion-server/pkg/server.New
/home/tock/go/pkg/mod/github.com/hyperledger-labs/orion-server@v0.2.0-fix-docker.0.20211123100045-9b59822eb800/pkg/server/server.go:45
github.com/hyperledger-labs/orion-sdk-go/examples/util.SetupTestEnvWithParams
/home/tock/go/src/github.com/hyperledger-labs/orion-sdk-go/examples/util/testutil.go:40
github.com/hyperledger-labs/orion-sdk-go/examples/util.SetupTestEnv
/home/tock/go/src/github.com/hyperledger-labs/orion-sdk-go/examples/util/testutil.go:24
github.com/hyperledger-labs/orion-sdk-go/examples/api/tx_validity.TestDataContext_ExecuteTxValidityExample
/home/tock/go/src/github.com/hyperledger-labs/orion-sdk-go/examples/api/tx_validity/tx_validity_test.go:19
testing.tRunner
/usr/local/go/src/testing/testing.go:1193
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1371
Test: TestDataContext_ExecuteTxValidityExample
FAIL
FAIL github.com/hyperledger-labs/orion-sdk-go/examples/api/tx_validity 0.598s