Skip to content

Commit a243976

Browse files
Test that warn log is catched by test - data delete error path
Issue: CLDSRV-669
1 parent 0a1b5f0 commit a243976

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/unit/api/apiUtils/object/abortMultipartUpload.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ describe('abortMultipartUpload', () => {
624624
it('should continue despite data deletion errors', done => {
625625
dataDeleteStub.restore();
626626
sinon.stub(data, 'delete').yields(errors.InternalError); // Fail data deletion
627+
const logWarnSpy = sinon.spy(log, 'warn');
627628

628629
createBucketAndMPU(false, (err, uploadId) => {
629630
assert.ifError(err);
@@ -651,6 +652,13 @@ describe('abortMultipartUpload', () => {
651652

652653
abortMultipartUpload(authInfo, bucketName, objectKey, uploadId, log, err => {
653654
assert.strictEqual(err, null); // Should succeed despite data deletion failure
655+
sinon.assert.called(logWarnSpy);
656+
const warnCall = logWarnSpy.getCalls().find(call =>
657+
call.args[0] === 'delete ObjectPart failed'
658+
);
659+
assert(warnCall, 'Expected warning log about failed data deletion');
660+
assert(warnCall.args[1].err, 'Expected error object in log warning');
661+
logWarnSpy.restore();
654662
done();
655663
}, abortRequest);
656664
});

0 commit comments

Comments
 (0)