index.js
function checkKeystoneReady (keystone, done) {
	async.retry({
		times: 10,
		interval: 3000,
	}, function (done, result) {
		console.log([moment().format('HH:mm:ss:SSS')] + ' kne: checking if KeystoneJS ready for request');
		request
			.get('http://' + keystone.get('host') + ':' + keystone.get('port') + '/keystone')
			.end(done);
	}, function (err, result) {
		if (!err) {
			console.log([moment().format('HH:mm:ss:SSS')] + ' kne: KeystoneJS Ready!');
			done();
		} else {
			console.log([moment().format('HH:mm:ss:SSS')] + ' kne: KeystoneJS does not appear ready!');
			done(err);
		}
	});
}
function checkKeystoneReady (keystone, done) {
	async.retry({
		times: 10,
		interval: 3000,
	}, function (done, result) {
		console.log([moment().format('HH:mm:ss:SSS')] + ' kne: checking if KeystoneJS ready for request');
		request
			.get('http://' + keystone.get('host') + ':' + keystone.get('port') + '/keystone')
			.end(done);
	}, function (err, result) {
		if (!err) {
			console.log([moment().format('HH:mm:ss:SSS')] + ' kne: KeystoneJS Ready!');
			done();
		} else {
			console.log([moment().format('HH:mm:ss:SSS')] + ' kne: KeystoneJS does not appear ready!');
			done(err);
		}
	});
}
function checkKeystoneReady ( keystone , done ) { async . retry ( { times : 10 , interval : 3000 , } , function ( done , result ) { console . log ( [ moment ( ) . format ( 'HH:mm:ss:SSS' ) ] + ' kne: checking if KeystoneJS ready for request' ) ; request . get ( 'http://' + keystone . get ( 'host' ) + ':' + keystone . get ( 'port' ) + '/keystone' ) . end ( done ) ; } , function ( err , result ) { if ( ! err ) { console . log ( [ moment ( ) . format ( 'HH:mm:ss:SSS' ) ] + ' kne: KeystoneJS Ready!' ) ; done ( ) ; } else { console . log ( [ moment ( ) . format ( 'HH:mm:ss:SSS' ) ] + ' kne: KeystoneJS does not appear ready!' ) ; done ( err ) ; } } ) ; }
Function that checks if keystone is ready before starting testing
Function that checks if keystone is ready before starting testing