Skip to content

Commit

Permalink
push
Browse files Browse the repository at this point in the history
  • Loading branch information
KillianG authored Nov 17, 2023
1 parent 52875fe commit 1f26c89
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions tests/functional/metadata/mongodb/listObject.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,31 +74,8 @@ describe('MongoClientInterface::metadata.listObject', () => {

function customListingParser(entries) {
return entries.map(entry => {
assert(entry.value.location === undefined);
const tmp = JSON.parse(entry.value);
return {
key: entry.key,
value: {
Size: tmp['content-length'],
ETag: tmp['content-md5'],
VersionId: tmp.versionId,
IsNull: tmp.isNull,
IsDeleteMarker: tmp.isDeleteMarker,
LastModified: tmp['last-modified'],
Owner: {
DisplayName: tmp['owner-display-name'],
ID: tmp['owner-id'],
},
StorageClass: tmp['x-amz-storage-class'],
// MPU listing properties
Initiated: tmp.initiated,
Initiator: tmp.initiator,
EventualStorageBucket: tmp.eventualStorageBucket,
partLocations: tmp.partLocations,
creationDate: tmp.creationDate,
ingestion: tmp.ingestion,
},
};
return tmp;
});
}

Expand All @@ -113,7 +90,6 @@ describe('MongoClientInterface::metadata.listObject', () => {
readPreference: 'primary',
database: DB_NAME,
},
customListingParser,
};
metadata = new MetadataWrapper(IMPL_NAME, opts, null, logger);
metadata.setup(done);
Expand Down Expand Up @@ -226,6 +202,31 @@ describe('MongoClientInterface::metadata.listObject', () => {
metadata.deleteBucket(BUCKET_NAME, logger, done);
});

it(`Should remove location property from object ${variation.it}`, done => {
async.series([
next => {
const opts = {
mongodb: {
replicaSetHosts: 'localhost:27020',
writeConcern: 'majority',
replicaSet: 'rs0',
readPreference: 'primary',
database: DB_NAME,
},
listingParser: customListingParser,
};
metadata = new MetadataWrapper(IMPL_NAME, opts, null, logger);
metadata.setup(next);
},
next => metadata.listObject(BUCKET_NAME, {}, logger, (err, data) => {
assert.ifError(err);

assert.strictEqual(data.Contents.length, 3);
return next();
}
]);
})

it(`Should list master versions of objects ${variation.it}`, done => {
const params = {
listingType: 'DelimiterMaster',
Expand Down

0 comments on commit 1f26c89

Please sign in to comment.