integration: allow overwriting address generator

This commit is contained in:
Oliver Gugger 2020-11-11 14:24:14 +01:00
parent 9250064837
commit 93cc7f36cf
No known key found for this signature in database
GPG key ID: 8E4256593F177720

View file

@ -58,6 +58,13 @@ var (
// Used to protest concurrent access to above declared variables.
harnessStateMtx sync.RWMutex
// ListenAddressGenerator is a function that is used to generate two
// listen addresses (host:port), one for the P2P listener and one for
// the RPC listener. This is exported to allow overwriting of the
// default behavior which isn't very concurrency safe (just selecting
// a random port can produce collisions and therefore flakes).
ListenAddressGenerator = generateListeningAddresses
)
// HarnessTestCase represents a test-case which utilizes an instance of the
@ -153,7 +160,7 @@ func New(activeNet *chaincfg.Params, handlers *rpcclient.NotificationHandlers,
}
// Generate p2p+rpc listening addresses.
config.listen, config.rpcListen = generateListeningAddresses()
config.listen, config.rpcListen = ListenAddressGenerator()
// Create the testing node bounded to the simnet.
node, err := newNode(config, nodeTestData)