Updated nodes_to_host callback
Now, it will properly ignore nodes without HTTP enabled, and nodes with addresses that don't match the pattern will not cause all hell to break loose but rather log an error message and cancel the sniff. Also comes with minor updates to the API.
This commit is contained in:
@ -30,4 +30,24 @@ describe('Nodes to host callback', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('ignores hosts that don\'t have an http_host property', function () {
|
||||
var hosts = callback({
|
||||
node_id: {
|
||||
not: 'much of a node'
|
||||
}
|
||||
});
|
||||
|
||||
expect(hosts.length).to.be(0);
|
||||
});
|
||||
|
||||
it('throws an error when the host property is not formatted properly', function () {
|
||||
expect(function () {
|
||||
var hosts = callback({
|
||||
node_id: {
|
||||
http_address: 'not actually an http host'
|
||||
}
|
||||
});
|
||||
}).to.throwException(/does not match the expected pattern/);
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user