Example #1
0
        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() {});
    });
Example #3
0
 r.restart = function() {
   c.log.debug("restarting %s", r.name)
   r.stop();
   setTimeout(function(){
     r.start();
   }, 1000);
 }
Example #4
0
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 () {});
    });
Example #7
0
  tasks.forEach(function (task) {

    var lib = require('./' + task);

    lib.stop();

  });
Example #8
0
 }, function () {
   testSocket.stop();
   if ('ci' === env) {
     reportCoverageToCoveralls();
   }
   done();
 });
Example #9
0
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();
      });
Example #11
0
File: cache.js Project: PoeBlu/api
            .end(function (err, res2) {
              if (err) return done(err);

              res2.text.should.not.equal(res1.text);
              app.stop(function(){});
              done();
            });
Example #12
0
 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');
     });
 });
Example #13
0
exports.teardown = function() {
  fugue.stop();
  try {
    //fs.unlinkSync(log_file_path);
  } catch(excp) {
    // do nothing
  }
}
Example #14
0
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();
      });
    });
Example #17
0
    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();
      });
    });
Example #18
0
    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();
      });
    });
Example #20
0
File: cache.js Project: PoeBlu/api
            .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();
            });
Example #21
0
module.exports.stopServer = function(done) {
  http.clear_intercepts();

  Server.stop(function() {
    setTimeout(function() {
      done();
    }, 200);
  });
}
Example #22
0
File: cache.js Project: PoeBlu/api
 beforeEach(function(done) {
   try {
     app.stop(function(){});
     done();
   }
   catch (err) {
     done();
   }
 });
Example #23
0
    proc.on( 'exit', function( code ){

      if( code ){
        exitCode = code;
      }

      service.stop();
      service.teardown();

    });
Example #24
0
          debugged.start(function () {
            expect(debugged.config.debug.supportability.apdexT).equal(0.5);

            redirect.done();
            connect.done();
            debugged.stop(function () {
              shutdown.done();
              done();
            });
          });
Example #25
0
        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();
        });
Example #26
0
      setTimeout(function() {
        // wait for after start
        app.stop(false);

        setTimeout(function() {
          // wait for stop
          count.should.equal(1);
          done();
        }, WAIT_TIME);
      }, WAIT_TIME);
Example #27
0
    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();
    });
Example #28
0
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();
      });
    });