Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that delete markers are not listed for version suspended buckets #5168

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenko/cloudserver",
"version": "8.7.21",
"version": "8.7.23",
"description": "Zenko CloudServer, an open-source Node.js implementation of a server handling the Amazon S3 protocol",
"main": "index.js",
"engines": {
Expand All @@ -21,7 +21,7 @@
"dependencies": {
"@azure/storage-blob": "^12.12.0",
"@hapi/joi": "^17.1.0",
"arsenal": "git+https://github.com/scality/arsenal#8.1.98",
"arsenal": "git+https://github.com/scality/arsenal#8.1.101",
"async": "~2.5.0",
"aws-sdk": "2.905.0",
"bucketclient": "scality/bucketclient#8.1.9",
Expand Down
54 changes: 54 additions & 0 deletions tests/functional/aws-node-sdk/test/bucket/listingCornerCases.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,58 @@ describe('Listing corner cases tests', () => {
}
});
});

it('should not list DeleteMarkers for version suspended buckets', done => {
const obj = { name: 'testDeleteMarker.txt', value: 'foo' };
const bucketName = `bucket-test-delete-markers-not-listed${Date.now()}`;
let objectCount = 0;
return async.waterfall([
next => s3.createBucket({ Bucket: bucketName }, err => next(err)),
next => {
const params = {
Bucket: bucketName,
VersioningConfiguration: {
Status: 'Suspended',
},
};
return s3.putBucketVersioning(params, err =>
next(err));
},
next => s3.putObject({
Bucket: bucketName,
Key: obj.name,
Body: obj.value,
}, err =>
next(err)),
next => s3.listObjectsV2({ Bucket: bucketName },
(err, res) => {
if (err) {
return next(err);
}
objectCount = res.Contents.length;
assert.strictEqual(res.Contents.some(c => c.Key === obj.name), true);
return next();
}),
next => s3.deleteObject({
Bucket: bucketName,
Key: obj.name,
}, function test(err) {
const headers = this.httpResponse.headers;
assert.strictEqual(
headers['x-amz-delete-marker'], 'true');
return next(err);
}),
next => s3.listObjectsV2({ Bucket: bucketName },
(err, res) => {
if (err) {
return next(err);
}
assert.strictEqual(res.Contents.length, objectCount - 1);
assert.strictEqual(res.Contents.some(c => c.Key === obj.name), false);
return next();
}),
next => s3.deleteObject({ Bucket: bucketName, Key: obj.name, VersionId: 'null' }, err => next(err)),
next => s3.deleteBucket({ Bucket: bucketName }, err => next(err))
], err => done(err));
});
});
Loading