Last active
March 14, 2017 12:40
-
-
Save denizozger/98a0601660a9e60617166537f5ac5a9d to your computer and use it in GitHub Desktop.
New health check script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assert = require('assert'); | |
var options = { | |
'auth': { | |
'user': 'USER', | |
'pass': 'PASS', | |
'sendImmediately': false | |
} | |
}; | |
console.log('Node ', process.version) | |
$http.get('URL', options, function (err, response, bodyStr) { | |
console.log('Response:', bodyStr); | |
assert.equal(response.statusCode, 200, 'Expected a 200 OK response'); | |
var body = JSON.parse(bodyStr) | |
Object.keys(body).forEach(function(k) { | |
const v = body[k] | |
assert(v.toLowerCase().indexOf('up') !== -1, (k + ' is not up')) | |
}) | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment