fix tests

This commit is contained in:
Jonathan Rainville 2018-05-23 09:54:13 -04:00
parent 6145c0b92c
commit 871c2fb228
1 changed files with 7 additions and 1 deletions

View File

@ -17,12 +17,14 @@ class Blockchain {
this.blockchainConfig = options.blockchainConfig;
this.web3 = options.web3;
this.addCheck = options.addCheck;
this.web3Endpoint = 'http://' + this.contractsConfig.deployment.host + ':' + this.contractsConfig.deployment.port;
this.web3Endpoint = '';
this.isWeb3Ready = false;
this.web3StartedInProcess = false;
if (!this.web3) {
this.initWeb3();
} else {
this.isWeb3Ready = true;
}
this.registerServiceCheck();
this.registerRequests();
@ -40,6 +42,7 @@ class Blockchain {
this.web3 = new Web3();
if (this.contractsConfig.deployment.type === "rpc") {
let provider;
this.web3Endpoint = 'http://' + this.contractsConfig.deployment.host + ':' + this.contractsConfig.deployment.port;
const providerOptions = {
web3: this.web3,
@ -224,6 +227,9 @@ class Blockchain {
next();
},
function pingEndpoint(next) {
if (!self.web3Endpoint) {
return next();
}
request.get(self.web3Endpoint, function (err, _response, _body) {
if (err) {
return next(NO_NODE_ERROR);