diff --git a/lib/api/objectDelete.js b/lib/api/objectDelete.js
index fe0f68f9a7..4b8f41ca07 100644
--- a/lib/api/objectDelete.js
+++ b/lib/api/objectDelete.js
@@ -190,6 +190,7 @@ function objectDeleteInternal(authInfo, request, log, isExpiration, cb) {
request,
true,
null,
+ overheadField,
log,
isExpiration
? 's3:LifecycleExpiration:DeleteMarkerCreated'
diff --git a/tests/unit/api/bucketPutVersioning.js b/tests/unit/api/bucketPutVersioning.js
index 4b50a1c20d..313f9f5d1e 100644
--- a/tests/unit/api/bucketPutVersioning.js
+++ b/tests/unit/api/bucketPutVersioning.js
@@ -6,7 +6,7 @@ const { bucketPut } = require('../../../lib/api/bucketPut');
const bucketPutVersioning = require('../../../lib/api/bucketPutVersioning');
const bucketPutReplication = require('../../../lib/api/bucketPutReplication');
-const { cleanup, DummyRequestLogger, makeAuthInfo } = require('../helpers');
+const { cleanup, DummyRequestLogger, makeAuthInfo, replicationTestUtils } = require('../helpers');
const metadata = require('../../../lib/metadata/wrapper');
const xmlEnableVersioning =
@@ -29,19 +29,6 @@ const locConstraintNonVersioned =
'withoutversioning' +
'';
-const xmlReplicationConfiguration =
- '' +
- 'arn:aws:iam::account-id:role/src-resource' +
- '' +
- '' +
- 'Enabled' +
- '' +
- 'arn:aws:s3:::destination-bucket' +
- 'us-east-2' +
- '' +
- '' +
- '';
-
const externalVersioningErrorMessage =
'We do not currently support putting a versioned object to a location-constraint of type Azure or GCP.';
@@ -59,16 +46,6 @@ function _getPutBucketRequest(xml) {
return request;
}
-function _putReplicationRequest(xml) {
- const request = {
- bucketName,
- headers: { host: `${bucketName}.s3.amazonaws.com` },
- url: '/?replication',
- };
- request.post = xml;
- return request;
-}
-
function _putVersioningRequest(xml) {
const request = {
bucketName,
@@ -126,7 +103,7 @@ describe('bucketPutVersioning API', () => {
},
// Put the replication config on the bucket.
next => {
- const request = _putReplicationRequest(xmlReplicationConfiguration);
+ const request = replicationTestUtils.createBucketPutReplicationReq(bucketName);
bucketPutReplication(authInfo, request, log, next);
},
// Attempt to suspend versioning.
diff --git a/tests/unit/api/objectDelete.js b/tests/unit/api/objectDelete.js
index 5d73e895c5..acb720ec21 100644
--- a/tests/unit/api/objectDelete.js
+++ b/tests/unit/api/objectDelete.js
@@ -7,7 +7,7 @@ const services = require('../../../lib/services');
const { bucketPut } = require('../../../lib/api/bucketPut');
const bucketPutACL = require('../../../lib/api/bucketPutACL');
const constants = require('../../../constants');
-const { cleanup, DummyRequestLogger, makeAuthInfo, versioningTestUtils } = require('../helpers');
+const { cleanup, DummyRequestLogger, makeAuthInfo, versioningTestUtils, replicationTestUtils } = require('../helpers');
const objectPut = require('../../../lib/api/objectPut');
const { objectDelete, objectDeleteInternal } = require('../../../lib/api/objectDelete');
const objectGet = require('../../../lib/api/objectGet');
@@ -17,6 +17,7 @@ const metadataswitch = require('../metadataswitch');
const { fakeMetadataArchive } = require('../../functional/aws-node-sdk/test/utils/init');
const bucketPutNotification = require('../../../lib/api/bucketPutNotification');
const bucketPutVersioning = require('../../../lib/api/bucketPutVersioning');
+const bucketPutReplication = require('../../../lib/api/bucketPutReplication');
const any = sinon.match.any;
const originalDeleteObject = services.deleteObject;
@@ -301,6 +302,35 @@ describe('objectDelete API', () => {
});
});
+ it('should delete an object in an NFS bucket with replication', done => {
+ const testNFSBucketPutRequest = new DummyRequest({
+ bucketName,
+ namespace,
+ headers: { 'x-scal-nfs-enabled': 'true' },
+ url: `/${bucketName}`,
+ });
+ async.series(
+ [
+ next => bucketPut(authInfo, testNFSBucketPutRequest, log, next),
+ next =>
+ bucketPutReplication(
+ authInfo,
+ replicationTestUtils.createBucketPutReplicationReq(bucketName),
+ log,
+ next,
+ ),
+ next => objectPut(authInfo, testPutObjectRequest, undefined, log, next),
+ next => objectDelete(authInfo, testDeleteRequest, log, next),
+ next =>
+ objectGet(authInfo, testGetObjectRequest, false, log, err => {
+ assert.strictEqual(err.is.NoSuchKey, true);
+ next();
+ }),
+ ],
+ done,
+ );
+ });
+
it('should log when expiration is trying to delete a master version', done => {
const warnStub = sinon.stub(log, 'warn');
const testBucketPutVersionRequest = new DummyRequest({
diff --git a/tests/unit/helpers.js b/tests/unit/helpers.js
index 9c230b3171..ecff6744e5 100644
--- a/tests/unit/helpers.js
+++ b/tests/unit/helpers.js
@@ -390,6 +390,26 @@ const versioningTestUtils = {
},
};
+const replicationTestUtils = {
+ createBucketPutReplicationReq: bucketName => ({
+ bucketName,
+ headers: { host: `${bucketName}.s3.amazonaws.com` },
+ url: '/?replication',
+ post:
+ '' +
+ 'arn:aws:iam::account-id:role/src-resource' +
+ '' +
+ '' +
+ 'Enabled' +
+ '' +
+ 'arn:aws:s3:::destination-bucket' +
+ 'us-east-2' +
+ '' +
+ '' +
+ '',
+ }),
+};
+
class TaggingConfigTester {
constructor() {
this._tags = { k1: 'v1', k2: 'v2' };
@@ -552,6 +572,7 @@ module.exports = {
CorsConfigTester,
objectLockTestUtils,
versioningTestUtils,
+ replicationTestUtils,
TaggingConfigTester,
AccessControlPolicy,
createRequestContext,