Add CYLON_TEST mode for TDR
This commit is contained in:
parent
387aaa618c
commit
02d0e138bb
|
@ -63,6 +63,7 @@
|
|||
this.commands = [];
|
||||
this.registerAdaptor("./test/loopback", "loopback");
|
||||
this.registerDriver("./test/ping", "ping");
|
||||
this.testing = process.env['CYLON_TEST'];
|
||||
this.initConnections(opts.connection || opts.connections);
|
||||
this.initDevices(opts.device || opts.devices);
|
||||
this.work = opts.work || function() {
|
||||
|
@ -204,6 +205,9 @@
|
|||
};
|
||||
|
||||
Robot.prototype.requireAdaptor = function(adaptorName) {
|
||||
if (this.robot.testing != null) {
|
||||
return this.robot.adaptors['loopback'];
|
||||
}
|
||||
if (this.robot.adaptors[adaptorName] == null) {
|
||||
this.robot.registerAdaptor("cylon-" + adaptorName, adaptorName);
|
||||
this.robot.adaptors[adaptorName].register(this);
|
||||
|
@ -229,6 +233,9 @@
|
|||
};
|
||||
|
||||
Robot.prototype.requireDriver = function(driverName) {
|
||||
if (this.robot.testing != null) {
|
||||
return this.robot.drivers['ping'];
|
||||
}
|
||||
if (this.robot.drivers[driverName] == null) {
|
||||
this.robot.registerDriver("cylon-" + driverName, driverName);
|
||||
this.robot.drivers[driverName].register(this);
|
||||
|
|
|
@ -62,6 +62,8 @@ namespace 'Cylon', ->
|
|||
@registerAdaptor "./test/loopback", "loopback"
|
||||
@registerDriver "./test/ping", "ping"
|
||||
|
||||
@testing = process.env['CYLON_TEST']
|
||||
|
||||
@initConnections(opts.connection or opts.connections)
|
||||
@initDevices(opts.device or opts.devices)
|
||||
@work = opts.work or -> (Logger.info "No work yet")
|
||||
|
@ -184,6 +186,8 @@ namespace 'Cylon', ->
|
|||
#
|
||||
# Returns the module for the adaptor
|
||||
requireAdaptor: (adaptorName) =>
|
||||
return @robot.adaptors['loopback'] if @robot.testing?
|
||||
|
||||
unless @robot.adaptors[adaptorName]?
|
||||
@robot.registerAdaptor "cylon-#{adaptorName}", adaptorName
|
||||
@robot.adaptors[adaptorName].register this
|
||||
|
@ -218,6 +222,8 @@ namespace 'Cylon', ->
|
|||
#
|
||||
# Returns the module for driver
|
||||
requireDriver: (driverName) =>
|
||||
return @robot.drivers['ping'] if @robot.testing?
|
||||
|
||||
unless @robot.drivers[driverName]?
|
||||
@robot.registerDriver "cylon-#{driverName}", driverName
|
||||
@robot.drivers[driverName].register this
|
||||
|
|
Loading…
Reference in New Issue