Skip to content

Commit

Permalink
make fakeredis work
Browse files Browse the repository at this point in the history
  • Loading branch information
evantahler committed Mar 4, 2016
1 parent cc097b0 commit a3e77fe
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions test/plugins/retry.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ describe('plugins', function(){
});

it('can have a retry count set', function(done){
this.timeout(1000 * 10);

var customJobs = {
"jobWithRetryCount": {
plugins: [ 'retry' ],
Expand Down Expand Up @@ -136,6 +138,8 @@ describe('plugins', function(){
});

it('can have custom retry times set', function(done){
this.timeout(1000 * 10);

var customJobs = {
"jobWithBackoffStrategy": {
plugins: [ 'retry' ],
Expand Down Expand Up @@ -191,6 +195,8 @@ describe('plugins', function(){
});

it('when a job fails it should be re-enqueued (and not go to the failure queue)', function(done){
this.timeout(1000 * 10);

queue.enqueue(specHelper.queue, "brokenJob", [1,2], function(){
var worker = new specHelper.NR.worker({
connection: specHelper.cleanConnectionDetails(),
Expand All @@ -216,6 +222,8 @@ describe('plugins', function(){
});

it('will handle the stats properly for failing jobs', function(done){
this.timeout(1000 * 10);

queue.enqueue(specHelper.queue, "brokenJob", [1,2], function(){
var worker = new specHelper.NR.worker({
connection: specHelper.cleanConnectionDetails(),
Expand All @@ -228,10 +236,10 @@ describe('plugins', function(){
specHelper.redis.get('resque_test:stat:failed', function(error, global_failed){
specHelper.redis.get('resque_test:stat:processed:' + worker.name, function(error, worker_processed){
specHelper.redis.get('resque_test:stat:failed:' + worker.name, function(error, worker_failed){
global_processed.should.equal('0');
global_failed.should.equal('1');
worker_processed.should.equal('0');
worker_failed.should.equal('1');
String(global_processed).should.equal('0');
String(global_failed).should.equal('1');
String(worker_processed).should.equal('0');
String(worker_failed).should.equal('1');
worker.end(done);
});
});
Expand All @@ -247,6 +255,8 @@ describe('plugins', function(){
});

it('will set the retry counter & retry data', function(done){
this.timeout(1000 * 10);

queue.enqueue(specHelper.queue, "brokenJob", [1,2], function(){
var worker = new specHelper.NR.worker({
connection: specHelper.cleanConnectionDetails(),
Expand All @@ -257,7 +267,7 @@ describe('plugins', function(){
var complete = function(){
specHelper.redis.get('resque_test:resque-retry:brokenJob:1-2', function(error, retryAttempts){
specHelper.redis.get('resque_test:failure-resque-retry:brokenJob:1-2', function(error, failureData){
retryAttempts.should.equal('0');
String(retryAttempts).should.equal('0');
failureData = JSON.parse(failureData);
failureData.payload.should.deepEqual([1,2]);
failureData.exception.should.equal('Error: BUSTED');
Expand Down

0 comments on commit a3e77fe

Please sign in to comment.