Compare commits

...

2 Commits

Author SHA1 Message Date
Alexander Chan 6769014ec8 [test] skip if mongo 2018-05-16 09:58:01 -07:00
Alexander Chan 6de5fb5d7d bf: ZENKO-314 add check for max keys zero object listing 2018-05-16 09:58:01 -07:00
3 changed files with 39 additions and 2 deletions

View File

@ -281,8 +281,18 @@ function bucketGet(authInfo, request, log, callback) {
listParams.versionIdMarker = params['version-id-marker'] ? listParams.versionIdMarker = params['version-id-marker'] ?
versionIdUtils.decode(params['version-id-marker']) : undefined; versionIdUtils.decode(params['version-id-marker']) : undefined;
} }
if (!requestMaxKeys) {
const emptyList = {
CommonPrefixes: [],
Contents: [],
Versions: [],
IsTruncated: false,
};
return handleResult(listParams, requestMaxKeys, encoding, authInfo,
bucketName, emptyList, corsHeaders, log, callback);
}
if (params.search !== undefined) { if (params.search !== undefined) {
log.info('performaing search listing', { search: params.search }); log.info('performing search listing', { search: params.search });
try { try {
listParams.mongifiedSearch = parseWhere(validatedAst); listParams.mongifiedSearch = parseWhere(validatedAst);
} catch (err) { } catch (err) {

View File

@ -6,8 +6,10 @@ const getConfig = require('../support/config');
const bucket = `versioning-bucket-${Date.now()}`; const bucket = `versioning-bucket-${Date.now()}`;
const skipIfMongo = process.env.S3METADATA === 'mongodb' ?
describe.skip : describe;
describe('aws-node-sdk test bucket versioning', function testSuite() { skipIfMongo('aws-node-sdk test bucket versioning', function testSuite() {
this.timeout(600000); this.timeout(600000);
let s3; let s3;
const versionIds = []; const versionIds = [];

View File

@ -125,6 +125,31 @@ describe('bucketGet API', () => {
}); });
}); });
it('should return empty list when max-keys is set to 0', done => {
const testGetRequest = {
bucketName,
namespace,
headers: { host: '/' },
url: `/${bucketName}`,
query: { 'max-keys': '0' },
};
async.waterfall([
next => bucketPut(authInfo, testPutBucketRequest, log, next),
(corsHeaders, next) => objectPut(authInfo, testPutObjectRequest1,
undefined, log, next),
(resHeaders, next) => objectPut(authInfo,
testPutObjectRequest2, undefined, log, next),
(resHeaders, next) => bucketGet(authInfo, testGetRequest,
log, next),
(result, corsHeaders, next) => parseString(result, next),
],
(err, result) => {
assert.strictEqual(result.ListBucketResult.Content, undefined);
done();
});
});
it('should return no more keys than max-keys specified', done => { it('should return no more keys than max-keys specified', done => {
const testGetRequest = { const testGetRequest = {
bucketName, bucketName,