Skip to content

Commit

Permalink
Merge branch 'w/8.5/bugfix/BB-450/replication' into tmp/octopus/w/8.6…
Browse files Browse the repository at this point in the history
…/bugfix/BB-450/replication
  • Loading branch information
bert-e committed Oct 11, 2023
2 parents 182b33c + 2dffcc9 commit b3a9dbe
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion extensions/lifecycle/tasks/LifecycleDeleteObjectTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class LifecycleDeleteObjectTask extends BackbeatTask {
return done(err);
}
const replicationStatus = objMD.getReplicationStatus();
if (['PENDING', 'PROCESSING', 'FAILED'].includes(replicationStatus)) {
if (replicationStatus && replicationStatus !== 'COMPLETED') {
const error = new PendingReplicationError('object has a pending replication status');
return done(error);
}
Expand Down
32 changes: 27 additions & 5 deletions tests/unit/lifecycle/LifecycleDeleteObjectTask.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,34 @@ describe('LifecycleDeleteObjectTask', () => {
});

[
'PENDING',
'PROCESSING',
'FAILED',
'COMPLETED',
undefined,
].forEach(status => {
it(`should skip replicating object : ${status}`, done => {
objMd.setReplicationStatus('PENDING');
it(`should delete replicating object with status: ${status}`, done => {
objMd.setReplicationStatus(status);
const entry = ActionQueueEntry.create('deleteObject')
.setAttribute('target.owner', 'testowner')
.setAttribute('target.bucket', 'testbucket')
.setAttribute('target.accountId', 'testid')
.setAttribute('target.key', 'testkey')
.setAttribute('target.version', 'testversion')
.setAttribute('details.lastModified', '2022-05-13T17:51:31.261Z');
s3Client.setResponse(null, {});
task.processActionEntry(entry, err => {
assert.strictEqual(s3Client.calls.deleteObject, 1);
assert.ifError(err);
done();
});
});
});

[
'PENDING',
'PROCESSING',
'FAILED',
].forEach(status => {
it(`should skip replicating object with status: ${status}`, done => {
objMd.setReplicationStatus(status);
const entry = ActionQueueEntry.create('deleteObject')
.setAttribute('target.owner', 'testowner')
.setAttribute('target.bucket', 'testbucket')
Expand Down

0 comments on commit b3a9dbe

Please sign in to comment.