2015-12-09 07:02:08 +08:00
|
|
|
|
2015-12-16 22:57:58 +08:00
|
|
|
var batch = require('../../batch/');
|
|
|
|
var JobPublisher = require('../../batch/job_publisher');
|
|
|
|
var JobQueueProducer = require('../../batch/job_queue_producer');
|
2015-12-09 07:02:08 +08:00
|
|
|
|
2015-12-16 22:57:58 +08:00
|
|
|
describe('batch', function() {
|
|
|
|
it('should be initialized successfuly', function () {
|
2015-12-14 17:36:16 +08:00
|
|
|
var metadataBackend = require('cartodb-redis')({
|
|
|
|
host: global.settings.redis_host,
|
|
|
|
port: global.settings.redis_port,
|
|
|
|
max: global.settings.redisPool,
|
|
|
|
idleTimeoutMillis: global.settings.redisIdleTimeoutMillis,
|
|
|
|
reapIntervalMillis: global.settings.redisReapIntervalMillis
|
|
|
|
});
|
|
|
|
|
2015-12-16 22:57:58 +08:00
|
|
|
batch(metadataBackend);
|
|
|
|
});
|
|
|
|
|
|
|
|
it.skip('should perform one job', function (done) {
|
|
|
|
var metadataBackend = require('cartodb-redis')({
|
|
|
|
host: global.settings.redis_host,
|
|
|
|
port: global.settings.redis_port,
|
|
|
|
max: global.settings.redisPool,
|
|
|
|
idleTimeoutMillis: global.settings.redisIdleTimeoutMillis,
|
|
|
|
reapIntervalMillis: global.settings.redisReapIntervalMillis
|
|
|
|
});
|
|
|
|
var jobQueueProducer = new JobQueueProducer(metadataBackend);
|
|
|
|
var jobPublisher = new JobPublisher();
|
|
|
|
|
|
|
|
batch(metadataBackend);
|
|
|
|
|
|
|
|
jobQueueProducer.enqueue('vizzuality', '127.0.0.1', function (err) {
|
|
|
|
if (err) {
|
|
|
|
return done(err);
|
|
|
|
}
|
|
|
|
jobPublisher.publish('127.0.0.1');
|
|
|
|
setTimeout(function () {
|
|
|
|
done();
|
|
|
|
}, 4000);
|
2015-12-10 03:17:45 +08:00
|
|
|
});
|
2015-12-09 07:02:08 +08:00
|
|
|
});
|
|
|
|
});
|