CartoDB-SQL-API/test/acceptance/batch.test.js

43 lines
1.5 KiB
JavaScript
Raw Normal View History

2015-12-09 07:02:08 +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
describe('batch', function() {
it('should be initialized successfuly', function () {
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
});
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
});
});