Merge pull request #719 from braydonf/tests

test: avoid port collision with a running regtest node
This commit is contained in:
Braydon Fuller 2019-03-11 14:24:42 -07:00
commit c65eec566f
No known key found for this signature in database
GPG Key ID: F24F232D108B3AD4
2 changed files with 26 additions and 7 deletions

View File

@ -11,30 +11,38 @@ const Outpoint = require('../lib/primitives/outpoint');
const MTX = require('../lib/primitives/mtx');
const FullNode = require('../lib/node/fullnode');
const pkg = require('../lib/pkg');
const Network = require('../lib/protocol/network');
const network = Network.get('regtest');
if (process.browser)
return;
const ports = {
p2p: 49331,
node: 49332,
wallet: 49333
};
const node = new FullNode({
network: 'regtest',
apiKey: 'foo',
walletAuth: true,
memory: true,
workers: true,
plugins: [require('../lib/wallet/plugin')]
});
plugins: [require('../lib/wallet/plugin')],
port: ports.p2p,
httpPort: ports.node,
env: {
'BCOIN_WALLET_HTTP_PORT': ports.wallet.toString()
}});
const {NodeClient, WalletClient} = require('bclient');
const nclient = new NodeClient({
port: network.rpcPort,
port: ports.node,
apiKey: 'foo'
});
const wclient = new WalletClient({
port: network.walletPort,
port: ports.wallet,
apiKey: 'foo'
});

View File

@ -16,12 +16,23 @@ const Peer = require('../lib/net/peer');
const InvItem = require('../lib/primitives/invitem');
const invTypes = InvItem.types;
const ports = {
p2p: 49331,
node: 49332,
wallet: 49333
};
const node = new FullNode({
memory: true,
apiKey: 'foo',
network: 'regtest',
workers: true,
plugins: [require('../lib/wallet/plugin')]
plugins: [require('../lib/wallet/plugin')],
port: ports.p2p,
httpPort: ports.node,
env: {
'BCOIN_WALLET_HTTP_PORT': ports.wallet.toString()
}
});
const chain = node.chain;