it("is stopped when both tasks are stopped", function () { var nestedTask = new Task(), pairedTask = new PairedTask(nestedTask); nestedTask.start(); nestedTask.stop(); pairedTask.start(); pairedTask.stop(); assert.ok(pairedTask.isStopped()); });
agent.harvest(function cb_harvest(error) { t.ok(error, "should have gotten back error for 503"); t.equal(agent.errors.errors.length, 1, "errors were merged back in"); var merged = agent.errors.errors[0]; t.deepEqual(merged[0], 0, "found timestamp in merged error"); t.deepEqual(merged[1], 'WebTransaction/Uri/*', "found scope in merged error"); t.deepEqual(merged[2], 'test error', "found message in merged error"); t.deepEqual( agent.metrics.toJSON(), [[ {name : "Errors/all"}, { total : 0, totalExclusive : 0, min : 0, max : 0, sumOfSquares : 0, callCount : 1 } ]], "metrics were merged" ); agent.stop(function cb_stop() {}); });
r.restart = function() { c.log.debug("restarting %s", r.name) r.stop(); setTimeout(function(){ r.start(); }, 1000); }
app.on("before-quit", (event) => { console.log("Shutting down server..."); event.preventDefault(); setTimeout(() => { process.exit(0); }, 3000); // Force-quit after 3 seconds. core.stop(); process.exit(0); });
reader.on('note',function(event){ events.push(event); if (event === 'ready') { reader.peripheral.client.events.data(new Buffer('0a')); reader.peripheral.client.events.data(new Buffer('b')); reader.peripheral.client.events.data(new Buffer('c1')); } if (event !== 'response') return; reader.stop(); events.should.eql(['ready','begin','middle','response']); test.mocknet.snapshot().should.eql([ {connect: {host: 'host',port: 1234}}, {end: null} ]); test.pp.snapshot().should.eql([ '[reader ] start watching', '[reader ] ready', '[reader ] response: "0abc1"', '[reader ] stop watching' ]); done(); });
agent.harvest(function (error) { t.notOk(error, "shouldn't have gotten back error for 413"); t.equal(agent.errors.errors.length, 0, "errors were discarded"); t.deepEqual(agent.metrics.toJSON(), [], "metrics were discarded"); agent.stop(function () {}); });
tasks.forEach(function (task) { var lib = require('./' + task); lib.stop(); });
}, function () { testSocket.stop(); if ('ci' === env) { reportCoverageToCoveralls(); } done(); });
Agent.prototype.stop = function (callback) { if (!callback) throw new TypeError("callback required!"); var agent = this; this.state('stopping'); this._stopHarvester(); sampler.stop(); if (this.collector.isConnected()) { this.collector.shutdown(function (error) { if (error) { agent.state('errored'); logger.warn(error, "Got error shutting down connection to New Relic:"); } else { agent.state('stopped'); logger.info("Stopped New Relic for Node.js."); } callback(error); }); } else { process.nextTick(callback); } };
agent.connection.on('transactionSampleDataError', function () { agent.connection.on('shutdownError', function () { t.ok(shutdown.isDone(), "tried to send shutdown"); }); agent.stop(); });
.end(function (err, res2) { if (err) return done(err); res2.text.should.not.equal(res1.text); app.stop(function(){}); done(); });
driver.start(function (errMsg) { started = true; A.isTrue(!errMsg, 'Should successfully start driver'); driver.stop(function (errMsg) { stopped = true; A.isTrue(!errMsg, 'Should successfully stop driver'); }); });
exports.teardown = function() { fugue.stop(); try { //fs.unlinkSync(log_file_path); } catch(excp) { // do nothing } }
TestHelper.prototype.stopServer = function(done) { if (!Server.readyState) return done() Server.stop(function() { setTimeout(function() { done() }, 100) }) }
agent._nextConnectAttempt = function (backoff) { t.ok(backoff, "got the backoff information"); t.equal(backoff.warn, false, "first retry doesn't warn"); t.equal(backoff.error, false, "first retry doesn't error"); t.equal(backoff.interval, 15, "first retry is after 15 seconds"); agent.stop(); clock.restore(); };
agent._sendErrors(function (error) { t.notOk(error, "sent errors without error"); agent.stop(function (error) { t.notOk(error, "stopped without error"); t.end(); }); });
agent._sendMetrics(function cb__sendMetrics(error) { t.notOk(error, "sent metrics without error"); agent.stop(function cb_stop(error) { t.notOk(error, "stopped without error"); t.end(); }); });
agent._sendTrace(function (error) { t.notOk(error, "trace sent correctly"); agent.stop(function (error) { t.notOk(error, "stopped without error"); t.end(); }); });
agent.harvest(function cb_harvest(error) { t.notOk(error, "harvest ran correctly"); agent.stop(function cb_stop(error) { t.notOk(error, "stopped without error"); t.end(); }); });
.end(function (err, res) { if (err) return done(err); res.text.should.eql('DATA'); res.headers['x-cache'].should.eql('HIT'); app.stop(function(){}); done(); });
module.exports.stopServer = function(done) { http.clear_intercepts(); Server.stop(function() { setTimeout(function() { done(); }, 200); }); }
beforeEach(function(done) { try { app.stop(function(){}); done(); } catch (err) { done(); } });
proc.on( 'exit', function( code ){ if( code ){ exitCode = code; } service.stop(); service.teardown(); });
debugged.start(function () { expect(debugged.config.debug.supportability.apdexT).equal(0.5); redirect.done(); connect.done(); debugged.stop(function () { shutdown.done(); done(); }); });
it("notifies that paired task is stopped only when both tasks are stopped", function (done) { var nestedTask = new Task(), pairedTask = new PairedTask(nestedTask); pairedTask.addListenerStop(function (evt) { assert.ok(nestedTask.isStopped()); assert.ok(pairedTask.isStopped()); done(); }); // starting order matters here pairedTask.start(); nestedTask.start(); pairedTask.stop(); nestedTask.stop(); });
setTimeout(function() { // wait for after start app.stop(false); setTimeout(function() { // wait for stop count.should.equal(1); done(); }, WAIT_TIME); }, WAIT_TIME);
connection.on('connect', function (response) { t.ok(connectResponseCalled, "already got redirect host when connected"); t.ok(handshakeResponseCalled, "already fetched agent configuration when connected"); t.ok(configUpdated, "configuration updated at connect time"); t.ok(response, "agent configuration made it through to the connect event"); t.ok(agent.config.run_id, "agent run ID is set after connect"); connected = true; agent.stop(); });
let gracefulShutdown = function() { console.log('Received kill signal, shutting down gracefully.') node.stop() redis.quit() setTimeout(function(){ process.exit(0) }, 1500) }
agent.harvest(function (error) { t.notOk(error, "no error received on 413"); t.ok(sendMetrics.isDone(), "sent metrics..."); t.ok(sendErrors.isDone(), "...and then sent error data..."); t.ok(sendTrace.isDone(), "...and then sent trace, even though all returned 413"); agent.stop(function () { t.ok(sendShutdown.isDone(), "got shutdown message"); t.end(); }); });
agent._sendMetrics(function (error) { t.notOk(error, "sent metrics without error"); t.ok(agent.mapper.map('TEST/discard') > 0, "received metric mapping"); agent.stop(function (error) { t.notOk(error, "stopped without error"); t.end(); }); });