Use a local data directory specific for reg testing.
This commit is contained in:
parent
072c109174
commit
bcc3a4c2e1
@ -11,4 +11,4 @@ before_install:
|
|||||||
- git config --global user.email "dev@bitpay.com"
|
- git config --global user.email "dev@bitpay.com"
|
||||||
- git config --global user.name "BitPay, Inc."
|
- git config --global user.name "BitPay, Inc."
|
||||||
script:
|
script:
|
||||||
- mocha -R spec integration/regtest.js
|
- _mocha -R spec integration/regtest.js
|
||||||
8
integration/data/bitcoin.conf
Normal file
8
integration/data/bitcoin.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
server=1
|
||||||
|
whitelist=127.0.0.1
|
||||||
|
txindex=1
|
||||||
|
rpcallowip=127.0.0.1
|
||||||
|
rpcuser=bitcoin
|
||||||
|
rpcpassword=local321
|
||||||
|
|
||||||
|
|
||||||
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
var chai = require('chai');
|
var chai = require('chai');
|
||||||
var bitcore = require('bitcore');
|
var bitcore = require('bitcore');
|
||||||
|
var rimraf = require('rimraf');
|
||||||
var bitcoind;
|
var bitcoind;
|
||||||
|
|
||||||
/* jshint unused: false */
|
/* jshint unused: false */
|
||||||
@ -17,39 +18,45 @@ describe('Basic Functionality', function() {
|
|||||||
|
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
bitcoind = require('../').daemon({
|
|
||||||
datadir: process.env.BITCOINDJS_DIR || '~/.bitcoin',
|
|
||||||
network: 'regtest',
|
|
||||||
server: true,
|
|
||||||
rpcuser: 'bitcoin',
|
|
||||||
rpcpassword: 'local321',
|
|
||||||
rpcallowip: '127.0.0.1'
|
|
||||||
});
|
|
||||||
|
|
||||||
bitcoind.on('error', function(err) {
|
rimraf('./data/regtest', function(err) {
|
||||||
bitcoind.log('error="%s"', err.message);
|
|
||||||
});
|
|
||||||
|
|
||||||
bitcoind.on('open', function(status) {
|
if (err) {
|
||||||
bitcoind.log('status="%s"', status);
|
throw err;
|
||||||
});
|
}
|
||||||
|
|
||||||
console.log('Waiting for Bitcoin Core to initialize...');
|
bitcoind = require('../').daemon({
|
||||||
|
datadir: './data',
|
||||||
bitcoind.on('ready', function() {
|
network: 'regtest'
|
||||||
|
|
||||||
var client = new BitcoinRPC({
|
|
||||||
protocol: 'http',
|
|
||||||
host: '127.0.0.1',
|
|
||||||
port: 18332,
|
|
||||||
user: 'bitcoin',
|
|
||||||
pass: 'local321'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
client.generate(100, function(err, result) {
|
bitcoind.on('error', function(err) {
|
||||||
console.log('err', err);
|
bitcoind.log('error="%s"', err.message);
|
||||||
console.log('result', result);
|
});
|
||||||
done();
|
|
||||||
|
bitcoind.on('open', function(status) {
|
||||||
|
bitcoind.log('status="%s"', status);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('Waiting for Bitcoin Core to initialize...');
|
||||||
|
|
||||||
|
bitcoind.on('ready', function() {
|
||||||
|
|
||||||
|
var client = new BitcoinRPC({
|
||||||
|
protocol: 'http',
|
||||||
|
host: '127.0.0.1',
|
||||||
|
port: 18332,
|
||||||
|
user: 'bitcoin',
|
||||||
|
pass: 'local321'
|
||||||
|
});
|
||||||
|
|
||||||
|
client.generate(100, function(err) {
|
||||||
|
if (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -55,6 +55,7 @@
|
|||||||
"chai": "^3.0.0",
|
"chai": "^3.0.0",
|
||||||
"mocha": "~1.16.2",
|
"mocha": "~1.16.2",
|
||||||
"proxyquire": "^1.3.1",
|
"proxyquire": "^1.3.1",
|
||||||
|
"rimraf": "^2.4.2",
|
||||||
"sinon": "^1.15.4"
|
"sinon": "^1.15.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user