artillery
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -8,3 +8,3 @@ #!/usr/bin/env node | ||
//nomnom.command('status').callback(index.status).help('show status'); | ||
nomnom.command('stop').callback(index.stop).help('stop a running test'); | ||
//nomnom.command('stop').callback(index.stop).help('stop a running test'); | ||
nomnom.command('result').callback(index.result).help('get test results'); | ||
@@ -11,0 +11,0 @@ nomnom.command('version').callback(index.version).help('display version info'); |
34
index.js
@@ -6,3 +6,3 @@ var rq = require('request'); | ||
run: run, | ||
stop: stop, | ||
//stop: stop, | ||
result: result, | ||
@@ -37,2 +37,3 @@ version: version | ||
} | ||
var body = JSON.parse(body); // FIXME | ||
if(body.message === 'success') { | ||
@@ -50,18 +51,18 @@ console.log('Success! Result id = %s, test id = %s', body.resultId, body.testId); | ||
function stop(opts) { | ||
mustHaveApiKey(); | ||
// function stop(opts) { | ||
// mustHaveApiKey(); | ||
var testId = opts[1]; | ||
// var testId = opts[1]; | ||
rq({ url: BASE + '/tests/' + testId + '/stop' + '?apiKey=' + API_KEY, rejectUnauthorized: false, method: 'PUT' }, onResponse); | ||
// rq({ url: BASE + '/tests/' + testId + '/stop' + '?apiKey=' + API_KEY, rejectUnauthorized: false, method: 'PUT' }, onResponse); | ||
function onResponse(err, res, body) { | ||
if(err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
// function onResponse(err, res, body) { | ||
// if(err) { | ||
// console.error(err); | ||
// process.exit(1); | ||
// } | ||
console.log(body); | ||
} | ||
} | ||
// console.log(body); | ||
// } | ||
// } | ||
@@ -71,4 +72,4 @@ function result(opts) { | ||
var testId = opts[1]; | ||
var resultId = opts[2]; | ||
var resultId = opts[1]; | ||
var testId = opts[2]; | ||
@@ -83,3 +84,4 @@ rq({ url: BASE + '/tests/' + testId + '/results/' + resultId + '?apiKey=' + API_KEY, rejectUnauthorized: false, method: 'GET' }, onResponse); | ||
console.log(body); | ||
var body = JSON.parse(body); | ||
console.log(JSON.stringify(body, null, 4)); | ||
} | ||
@@ -86,0 +88,0 @@ } |
{ | ||
"name": "artillery", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "CLI for artillery.io", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
4019
102