From aebfa168e6aa60098c0e6c2703950503fe1ce847 Mon Sep 17 00:00:00 2001 From: Jcar Date: Thu, 20 Dec 2012 11:45:06 -0800 Subject: [PATCH] test/server.js asserts on exit that stop() has been called (to detect improper exit) --- test/server-test.js | 2 +- test/server.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/server-test.js b/test/server-test.js index 39616f7fe9..dd28ed6188 100644 --- a/test/server-test.js +++ b/test/server-test.js @@ -9,7 +9,7 @@ var alpha; buster.testCase("Standalone server startup", { "server start and stop" : function (done) { - alpha = Server.from_config("alpha",true); + alpha = Server.from_config("alpha"); //ADD ,true for verbosity alpha .on('started', function () { diff --git a/test/server.js b/test/server.js index 400abf6ae0..c1ffd09e1a 100644 --- a/test/server.js +++ b/test/server.js @@ -31,6 +31,7 @@ var Server = function (name, config, verbose) { this.config = config; this.started = false; this.quiet = !verbose; + this.stopping = false; //Not sure if we need this... }; Server.prototype = new EventEmitter; @@ -99,6 +100,7 @@ Server.prototype._serverSpawnSync = function() { this.child.on('exit', function(code, signal) { // If could not exec: code=127, signal=null // If regular exit: code=0, signal=null + buster.assert(!self.stopping); //Fail the test if the server is exiting without having called "stop" if (!self.quiet) console.log("server: spawn: server exited code=%s: signal=%s", code, signal); }); }; @@ -148,7 +150,7 @@ Server.prototype.start = function () { // Stop a standalone server. Server.prototype.stop = function () { var self = this; - + self.stopping = true; //Tell the caller that the server is properly stopping. if (this.child) { // Update the on exit to invoke done. this.child.on('exit', function (code, signal) {