-
Notifications
You must be signed in to change notification settings - Fork 2
/
test-runner.js
40 lines (36 loc) · 1013 Bytes
/
test-runner.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'use strict';
const Swimlane = require('./swimlane');
const request = require('request');
const bunyan = require('bunyan');
const requestWithDefaults = request.defaults({
rejectUnauthorized: false
});
// Fill in the options
let options = {
url: '',
username: '',
password: '',
applications: '',
numTags: 5
};
const logger = bunyan.createLogger({ name: 'Mocha Test', level: bunyan.TRACE });
const swimlane = new Swimlane(requestWithDefaults, logger);
if(process.argv.length === 2){
logger.error('Please pass in an IP address to search for');
return;
}
const ipToSearch = process.argv[2];
swimlane.cacheApps(options, (err) => {
if (err) {
logger.error({err:err}, 'Error Caching Apps');
} else {
logger.info('Caching Apps Successful!');
swimlane.search(ipToSearch, options, (err, results) => {
if (err) {
logger.error({err:err}, 'Error Running swimlane.search()');
} else {
logger.info({results:results}, 'Search Results');
}
});
}
});