Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Commit

Permalink
don't instantiate tunnel if opt.tunnel is false
Browse files Browse the repository at this point in the history
  • Loading branch information
vweevers committed Oct 1, 2017
1 parent e8a1965 commit 542b122
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/setup.js
Expand Up @@ -12,18 +12,22 @@ function setup_test_instance(opt, cb) {
var support_server = undefined;
var bouncer = undefined;
var Tunnel;
var tunnel;

if (typeof opt.tunnel === 'string') {
Tunnel = require('zuul-' + opt.tunnel);
debug('using zuul-%s to tunnel', opt.tunnel);
} else if (typeof opt.tunnel === 'object' && opt.tunnel.type) {
Tunnel = require('zuul-' + opt.tunnel.type);
debug('using zuul-%s to tunnel', opt.tunnel.type);
} else {
} else if (opt.tunnel !== false) {
Tunnel = require('zuul-localtunnel');
debug('using zuul-localhost to tunnel');
}

var tunnel = new Tunnel(opt);
if (Tunnel) {
tunnel = new Tunnel(opt);
}

if (opt.server) {
user_server(opt.server, setup);
Expand Down Expand Up @@ -100,7 +104,7 @@ function setup_test_instance(opt, cb) {
var app_port = bouncer.address().port;
debug('bouncer active on port %d', app_port);

if (!config.tunnel) {
if (!tunnel) {
return cb(null, 'http://' + loopback + ':' + app_port + '/__zuul');
}

Expand All @@ -110,7 +114,10 @@ function setup_test_instance(opt, cb) {

function shutdown() {
bouncer.close();
tunnel.close();

if (tunnel) {
tunnel.close();
}

if (support_server) {
support_server.process.kill('SIGKILL');
Expand Down

0 comments on commit 542b122

Please sign in to comment.