Fix failing test on blockchain

This commit is contained in:
Andre Medeiros 2018-07-11 11:38:58 -04:00 committed by Iuri Matias
parent db7553cf0f
commit 8be8ca508f
4 changed files with 17 additions and 3 deletions

View File

@ -96,12 +96,21 @@ Blockchain.prototype.setupProxy = function() {
let ipcObject = new Ipc({ipcRole: 'client'});
proxy.serve(ipcObject, this.config.rpcHost, this.config.rpcPort, false);
proxy.serve(ipcObject, this.config.wsHost, this.config.wsPort, true);
this.rpcProxy = proxy.serve(ipcObject, this.config.rpcHost, this.config.rpcPort, false);
this.wsProxy = proxy.serve(ipcObject, this.config.wsHost, this.config.wsPort, true);
this.config.rpcPort += constants.blockchain.servicePortOnProxy;
this.config.wsPort += constants.blockchain.servicePortOnProxy;
};
Blockchain.prototype.shutdownProxy = function() {
if (!this.config.proxy) {
return;
}
this.rpcProxy.close();
this.wsProxy.close();
}
Blockchain.prototype.runCommand = function(cmd, options, callback) {
console.log(__("running: %s", cmd.underline).green);
if (this.blockchainConfig.silent) {
@ -220,6 +229,8 @@ Blockchain.prototype.readyCallback = function() {
};
Blockchain.prototype.kill = function() {
this.shutdownProxy();
if (this.child) {
this.child.kill();
}

View File

@ -123,4 +123,5 @@ exports.serve = function(ipc, host, port, ws){
}
server.listen(port, defaultHost);
return server;
};

View File

@ -52,6 +52,7 @@ describe('embark.Blockchain', function () {
config.rpcPort += constants.blockchain.servicePortOnProxy;
}
assert.deepEqual(blockchain.config, config);
blockchain.kill();
done();
});
});
@ -96,6 +97,7 @@ describe('embark.Blockchain', function () {
}
assert.deepEqual(blockchain.config, config);
blockchain.kill();
done();
});
});

View File

@ -1,7 +1,7 @@
/*global describe, it, before, beforeEach*/
const assert = require('assert');
const sinon = require('sinon');
const TestLogger = require('../lib/tests/test_logger.js');
const TestLogger = require('../lib/tests/test_logger');
const ProcessLauncher = require('../lib/process/processLauncher');
describe('ProcessWrapper', () => {