Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chain-smoker

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chain-smoker

Smokes a suite of tests a day (at least)

  • 0.2.8
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Chain Smoker

It runs your tests. It checks the callbacks. Chain Smoker is an old curmudgeon that will yell at you when your stuff falls over.

It's totally not ready for use yet. Come back later.

Setup

Chain Smoker requires Redis.

  1. Install Chain Smoker
$ npm install chain-smoker --save
  1. Create your test suite.
var ChainSmoker = require('chain-smoker');

var Suite = {};

Suite.tests = [
  {
    name: 'example-get',
    address: 'http://example.com',
    assertions: {
      statusCode: 200
    }
  },
  {
    name: 'example-callback',
    address: 'http://example.com/call/me/back',
    method: 'POST',
    headers: {
      'X-Awesome-Header': 'this is really cool'
    },
    body: {
      neato: true,
      callback_url: 'http://this-hostname/callback/example-callback'
    },
    assertions: {
      statusCode: 201
    },
    callback_assertions: {
      job_success: function(req) {
        return req.body.status === 'success';
      }
    },
    callback_time_limit: 10000,
    external_id: function(req) {
      return req.body.id;
    }
  }
];

var options = {
  apiPort: 8080,
  lateCallback: function(jobs) {
    if (jobs.length === 0) {
      console.log('There are no late jobs!');
    } else {
      console.log('There are '+ jobs.length +' late jobs!');
      console.log(jobs);
    }
  }
}

ChainSmoker(Suite, options, function(err, runner) {
  if (err) return console.log(err);
  console.log('Locked and loaded.');

  // Now that everything's nice and ready, we need to
  // kick off the tests. Sit back and let the man smoke.
  runner.runAll();
});
  1. Enjoy.

Test options

OptionDetails (default)
nameString (null) - Name of the test (really useful for callback routing)
addressstring (null) - Endpoint to hit for the test
methodstring (GET) - HTTP method to use when hitting the specified address
headersObject ({}) - Headers to deliver when making the request
bodyString or Object ('null') - If an object is given, it will be stringified before making the request.
external_idFunction (msg.body.id) - Function that returns a unique ID from the response. If this is null, msg.body.id is blindly used, so external_id could potentially be null.
assertionsObject ({}) - Object containing the assertions to run against the initial request. The values of each assertion can either be a string (or object) to compare against the key of the same name in the response, or a function that returns true or false.
callback_assertionsObject (null) - Same as above, but for the callback received from the initial request
callback_time_limitInteger (0) - Amount of time (in milliseconds) before a callback is considered late. After this point, the late jobs begin to show up in the lateCallback mentioned below.

Chain Smoker Run Options

OptionValues (default)Details
apiPortInteger (3000)The port to use for the callback server
lateCallbackFn([jobs]) (noop())The function to call when the check for late jobs comes back. The callback fires even if the array is empty, which can be useful to clear out any pager alerts or other things fired when the array was not empty.
lateCheckFrequencyInteger (1500)How often in milliseconds to check for late jobs
disableCleanerBoolean (false)If true, old completed jobs will not be removed from the database
cleanFailuresBoolean (false)Whether or not to remove jobs that have completed, but were unsuccessful
maxCompletedAgeInteger (3600000)If cleanup is enabled, this is the age (in milliseconds) threshold before a job is cleaned. Default is 1 hour.
cleanFrequencyInteger (5000)How often in milliseconds to run the cleanup check

FAQs

Package last updated on 15 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc