mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 18:45:52 +00:00
UT: Allow tests to use existing server.
This commit is contained in:
@@ -18,8 +18,8 @@ exports.servers = {
|
||||
'rpc_port' : 5005,
|
||||
'websocket_ip' : "127.0.0.1",
|
||||
'websocket_port' : 6005,
|
||||
'validation_seed' : "shhDFVsmS2GSu5vUyZSPXYfj1r79h",
|
||||
'validators' : "n9L8LZZCwsdXzKUN9zoVxs4YznYXZ9hEhsQZY7aVpxtFaSceiyDZ beta"
|
||||
// 'validation_seed' : "shhDFVsmS2GSu5vUyZSPXYfj1r79h",
|
||||
// 'validators' : "n9L8LZZCwsdXzKUN9zoVxs4YznYXZ9hEhsQZY7aVpxtFaSceiyDZ beta"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -19,8 +19,9 @@ var child = require("child_process");
|
||||
var servers = {};
|
||||
|
||||
// Create a server object
|
||||
var Server = function (name) {
|
||||
var Server = function (name, mock) {
|
||||
this.name = name;
|
||||
this.mock = mock;
|
||||
};
|
||||
|
||||
// Return a server's rippled.cfg as string.
|
||||
@@ -92,20 +93,29 @@ Server.prototype.makeBase = function (done) {
|
||||
Server.prototype.start = function (done) {
|
||||
var self = this;
|
||||
|
||||
this.makeBase(function (e) {
|
||||
if (e) {
|
||||
throw e;
|
||||
}
|
||||
else {
|
||||
self.serverSpawnSync();
|
||||
done();
|
||||
}
|
||||
});
|
||||
if (this.mock) {
|
||||
done();
|
||||
}
|
||||
else {
|
||||
this.makeBase(function (e) {
|
||||
if (e) {
|
||||
throw e;
|
||||
}
|
||||
else {
|
||||
self.serverSpawnSync();
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Stop a standalone server.
|
||||
Server.prototype.stop = function (done) {
|
||||
if (this.child) {
|
||||
if (this.mock) {
|
||||
console.log("server: stop: mock");
|
||||
done();
|
||||
}
|
||||
else if (this.child) {
|
||||
// Update the on exit to invoke done.
|
||||
this.child.on('exit', function (code, signal) {
|
||||
console.log("server: stop: server exited");
|
||||
@@ -121,14 +131,14 @@ Server.prototype.stop = function (done) {
|
||||
};
|
||||
|
||||
// Start the named server.
|
||||
exports.start = function (name, done) {
|
||||
exports.start = function (name, done, mock) {
|
||||
if (servers[name])
|
||||
{
|
||||
console.log("server: start: server already started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
var server = new Server(name);
|
||||
var server = new Server(name, mock);
|
||||
|
||||
servers[name] = server;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user