Compare commits

...

1 Commits

Author SHA1 Message Date
Jordi Bertran de Balanda 2d556da4b2 Bump arsenal, make the easy changes 2022-04-17 20:27:01 +02:00
55 changed files with 200 additions and 204 deletions

View File

@ -49,7 +49,7 @@ function updateRequestContexts(request, requestContexts, apiMethod, log, cb) {
return metadata.getObjectMD(bucketName, objectKey, { versionId: reqVersionId }, log, return metadata.getObjectMD(bucketName, objectKey, { versionId: reqVersionId }, log,
(err, objMD) => { (err, objMD) => {
if (err) { if (err) {
if (err.NoSuchKey) { if (err.is.NoSuchKey) {
return next(); return next();
} }
log.trace('error getting request object tags'); log.trace('error getting request object tags');

View File

@ -22,7 +22,7 @@ function addToUsersBucket(canonicalID, bucketName, log, cb) {
// Get new format usersBucket to see if it exists // Get new format usersBucket to see if it exists
return metadata.getBucket(usersBucket, log, (err, usersBucketAttrs) => { return metadata.getBucket(usersBucket, log, (err, usersBucketAttrs) => {
if (err && !err.NoSuchBucket && !err.BucketAlreadyExists) { if (err && !err.is.NoSuchBucket && !err.is.BucketAlreadyExists) {
return cb(err); return cb(err);
} }
const splitter = usersBucketAttrs ? const splitter = usersBucketAttrs ?
@ -36,7 +36,7 @@ function addToUsersBucket(canonicalID, bucketName, log, cb) {
usersBucket : oldUsersBucket; usersBucket : oldUsersBucket;
return metadata.putObjectMD(usersBucketBeingCalled, key, return metadata.putObjectMD(usersBucketBeingCalled, key,
omVal, {}, log, err => { omVal, {}, log, err => {
if (err && err.NoSuchBucket) { if (err && err.is.NoSuchBucket) {
// There must be no usersBucket so createBucket // There must be no usersBucket so createBucket
// one using the new format // one using the new format
log.trace('users bucket does not exist, ' + log.trace('users bucket does not exist, ' +
@ -57,8 +57,7 @@ function addToUsersBucket(canonicalID, bucketName, log, cb) {
// error with respect // error with respect
// to the usersBucket. // to the usersBucket.
if (err && if (err &&
err !== !err.is.BucketAlreadyExists) {
errors.BucketAlreadyExists) {
log.error('error from metadata', { log.error('error from metadata', {
error: err, error: err,
}); });
@ -206,7 +205,7 @@ function createBucket(authInfo, bucketName, headers,
}, },
getAnyExistingBucketInfo: function getAnyExistingBucketInfo(callback) { getAnyExistingBucketInfo: function getAnyExistingBucketInfo(callback) {
metadata.getBucket(bucketName, log, (err, data) => { metadata.getBucket(bucketName, log, (err, data) => {
if (err && err.NoSuchBucket) { if (err && err.is.NoSuchBucket) {
return callback(null, 'NoBucketYet'); return callback(null, 'NoBucketYet');
} }
if (err) { if (err) {

View File

@ -16,7 +16,7 @@ function _deleteMPUbucket(destinationBucketName, log, cb) {
`${mpuBucketPrefix}${destinationBucketName}`; `${mpuBucketPrefix}${destinationBucketName}`;
return metadata.deleteBucket(mpuBucketName, log, err => { return metadata.deleteBucket(mpuBucketName, log, err => {
// If the mpu bucket does not exist, just move on // If the mpu bucket does not exist, just move on
if (err && err.NoSuchBucket) { if (err && err.is.NoSuchBucket) {
return cb(); return cb();
} }
return cb(err); return cb(err);
@ -90,7 +90,7 @@ function deleteBucket(authInfo, bucketMD, bucketName, canonicalID, log, cb) {
log, (err, objectsListRes) => { log, (err, objectsListRes) => {
// If no shadow bucket ever created, no ongoing MPU's, so // If no shadow bucket ever created, no ongoing MPU's, so
// continue with deletion // continue with deletion
if (err && err.NoSuchBucket) { if (err && err.is.NoSuchBucket) {
return next(); return next();
} }
if (err) { if (err) {

View File

@ -11,16 +11,16 @@ function deleteUserBucketEntry(bucketName, canonicalID, log, cb) {
metadata.deleteObjectMD(usersBucket, keyForUserBucket, {}, log, error => { metadata.deleteObjectMD(usersBucket, keyForUserBucket, {}, log, error => {
// If the object representing the bucket is not in the // If the object representing the bucket is not in the
// users bucket just continue // users bucket just continue
if (error && error.NoSuchKey) { if (error && error.is.NoSuchKey) {
return cb(null); return cb(null);
// BACKWARDS COMPATIBILITY: Remove this once no longer // BACKWARDS COMPATIBILITY: Remove this once no longer
// have old user bucket format // have old user bucket format
} else if (error && error.NoSuchBucket) { } else if (error && error.is.NoSuchBucket) {
const keyForUserBucket2 = createKeyForUserBucket(canonicalID, const keyForUserBucket2 = createKeyForUserBucket(canonicalID,
oldSplitter, bucketName); oldSplitter, bucketName);
return metadata.deleteObjectMD(oldUsersBucket, keyForUserBucket2, return metadata.deleteObjectMD(oldUsersBucket, keyForUserBucket2,
{}, log, error => { {}, log, error => {
if (error && !error.NoSuchKey) { if (error && !error.is.NoSuchKey) {
log.error('from metadata while deleting user bucket', log.error('from metadata while deleting user bucket',
{ error }); { error });
return cb(error); return cb(error);

View File

@ -292,7 +292,7 @@ function versioningPreprocessing(bucketName, bucketMD, objectKey, objMD,
// it's possible there was a concurrent request to // it's possible there was a concurrent request to
// delete the null version, so proceed with putting a // delete the null version, so proceed with putting a
// new version // new version
if (err === errors.NoSuchKey) { if (err === errors.is.NoSuchKey) {
return next(null, options); return next(null, options);
} }
return next(errors.InternalError); return next(errors.InternalError);

View File

@ -341,7 +341,7 @@ function completeMultipartUpload(authInfo, request, log, callback) {
if (err) { if (err) {
// TODO: check AWS error when user requested a specific // TODO: check AWS error when user requested a specific
// version before any versions have been put // version before any versions have been put
const logLvl = err === errors.BadRequest ? const logLvl = err.is.BadRequest ?
'debug' : 'error'; 'debug' : 'error';
log[logLvl]('error getting versioning info', { log[logLvl]('error getting versioning info', {
error: err, error: err,

View File

@ -210,10 +210,10 @@ function getObjMetadataAndDelete(authInfo, canonicalID, request,
(versionId, callback) => metadataGetObject(bucketName, entry.key, (versionId, callback) => metadataGetObject(bucketName, entry.key,
versionId, log, (err, objMD) => { versionId, log, (err, objMD) => {
// if general error from metadata return error // if general error from metadata return error
if (err && !err.NoSuchKey) { if (err && !err.is.NoSuchKey) {
return callback(err); return callback(err);
} }
if (err && err.NoSuchKey) { if (err && err.is.NoSuchKey) {
const verCfg = bucket.getVersioningConfiguration(); const verCfg = bucket.getVersioningConfiguration();
// To adhere to AWS behavior, create a delete marker // To adhere to AWS behavior, create a delete marker
// if trying to delete an object that does not exist // if trying to delete an object that does not exist
@ -386,11 +386,11 @@ function multiObjectDelete(authInfo, request, log, callback) {
return vault.checkPolicies(requestContextParams, authInfo.getArn(), return vault.checkPolicies(requestContextParams, authInfo.getArn(),
log, (err, authorizationResults) => { log, (err, authorizationResults) => {
// there were no policies so received a blanket AccessDenied // there were no policies so received a blanket AccessDenied
if (err && err.AccessDenied) { if (err && err.is.AccessDenied) {
objects.forEach(entry => { objects.forEach(entry => {
errorResults.push({ errorResults.push({
entry, entry,
error: errors.AccessDenied }); error: errors.is.AccessDenied });
}); });
// send empty array for inPlay // send empty array for inPlay
return next(null, quietSetting, errorResults, []); return next(null, quietSetting, errorResults, []);

View File

@ -29,10 +29,10 @@ function multipartDelete(authInfo, request, log, callback) {
request.method, destinationBucket); request.method, destinationBucket);
const location = destinationBucket ? const location = destinationBucket ?
destinationBucket.getLocationConstraint() : null; destinationBucket.getLocationConstraint() : null;
if (err && err !== errors.NoSuchUpload) { if (err && !err.is.NoSuchUpload) {
return callback(err, corsHeaders); return callback(err, corsHeaders);
} }
if (err === errors.NoSuchUpload && isLegacyAWSBehavior(location)) { if (err.is.NoSuchUpload && isLegacyAWSBehavior(location)) {
log.trace('did not find valid mpu with uploadId', { log.trace('did not find valid mpu with uploadId', {
method: 'multipartDelete', method: 'multipartDelete',
uploadId, uploadId,

View File

@ -182,7 +182,7 @@ function objectPutCopyPart(authInfo, request, sourceBucket,
sourceLocationConstraintName, next) { sourceLocationConstraintName, next) {
return metadata.getBucket(mpuBucketName, log, return metadata.getBucket(mpuBucketName, log,
(err, mpuBucket) => { (err, mpuBucket) => {
if (err && err.NoSuchBucket) { if (err && err.is.NoSuchBucket) {
return next(errors.NoSuchUpload); return next(errors.NoSuchUpload);
} }
if (err) { if (err) {
@ -211,7 +211,7 @@ function objectPutCopyPart(authInfo, request, sourceBucket,
return metadata.getObjectMD(mpuBucketName, mpuOverviewKey, return metadata.getObjectMD(mpuBucketName, mpuOverviewKey,
null, log, (err, res) => { null, log, (err, res) => {
if (err) { if (err) {
if (err.NoSuchKey) { if (err.is.NoSuchKey) {
return next(errors.NoSuchUpload); return next(errors.NoSuchUpload);
} }
log.error('error getting overview object from ' + log.error('error getting overview object from ' +
@ -263,7 +263,7 @@ function objectPutCopyPart(authInfo, request, sourceBucket,
metadata.getObjectMD(mpuBucketName, partKey, {}, log, metadata.getObjectMD(mpuBucketName, partKey, {}, log,
(err, result) => { (err, result) => {
// If there is nothing being overwritten just move on // If there is nothing being overwritten just move on
if (err && !err.NoSuchKey) { if (err && !err.is.NoSuchKey) {
log.debug('error getting current part (if any)', log.debug('error getting current part (if any)',
{ error: err }); { error: err });
return next(err); return next(err);

View File

@ -94,7 +94,7 @@ function objectPutPart(authInfo, request, streamingV4Params, log,
// Get the destination bucket. // Get the destination bucket.
next => metadata.getBucket(bucketName, log, next => metadata.getBucket(bucketName, log,
(err, destinationBucket) => { (err, destinationBucket) => {
if (err && err.NoSuchBucket) { if (err && err.is.NoSuchBucket) {
return next(errors.NoSuchBucket, destinationBucket); return next(errors.NoSuchBucket, destinationBucket);
} }
if (err) { if (err) {
@ -142,7 +142,7 @@ function objectPutPart(authInfo, request, streamingV4Params, log,
(destinationBucket, cipherBundle, next) => (destinationBucket, cipherBundle, next) =>
metadata.getBucket(mpuBucketName, log, metadata.getBucket(mpuBucketName, log,
(err, mpuBucket) => { (err, mpuBucket) => {
if (err && err.NoSuchBucket) { if (err && err.is.NoSuchBucket) {
return next(errors.NoSuchUpload, destinationBucket); return next(errors.NoSuchUpload, destinationBucket);
} }
if (err) { if (err) {
@ -252,7 +252,7 @@ function objectPutPart(authInfo, request, streamingV4Params, log,
return metadata.getObjectMD(mpuBucketName, partKey, {}, log, return metadata.getObjectMD(mpuBucketName, partKey, {}, log,
(err, res) => { (err, res) => {
// If there is no object with the same key, continue. // If there is no object with the same key, continue.
if (err && !err.NoSuchKey) { if (err && !err.is.NoSuchKey) {
log.error('error getting current part (if any)', { log.error('error getting current part (if any)', {
error: err, error: err,
method: 'objectPutPart::metadata.getObjectMD', method: 'objectPutPart::metadata.getObjectMD',

View File

@ -147,7 +147,7 @@ function websiteGet(request, log, callback) {
'bucketGet', constants.publicId, null, log, request); 'bucketGet', constants.publicId, null, log, request);
// if index object does not exist and bucket is private AWS // if index object does not exist and bucket is private AWS
// returns 403 - AccessDenied error. // returns 403 - AccessDenied error.
if (err === errors.NoSuchKey && !bucketAuthorized) { if (err.is.NoSuchKey && !bucketAuthorized) {
returnErr = errors.AccessDenied; returnErr = errors.AccessDenied;
} }
return _errorActions(returnErr, return _errorActions(returnErr,

View File

@ -107,7 +107,7 @@ function websiteHead(request, log, callback) {
'bucketGet', constants.publicId, null, log, request); 'bucketGet', constants.publicId, null, log, request);
// if index object does not exist and bucket is private AWS // if index object does not exist and bucket is private AWS
// returns 403 - AccessDenied error. // returns 403 - AccessDenied error.
if (err === errors.NoSuchKey && !bucketAuthorized) { if (err.is.NoSuchKey && !bucketAuthorized) {
returnErr = errors.AccessDenied; returnErr = errors.AccessDenied;
} }
return _errorActions(returnErr, routingRules, return _errorActions(returnErr, routingRules,

View File

@ -84,7 +84,7 @@ class AzureClient {
return metadata.listMultipartUploads(mpuBucketName, listingParams, return metadata.listMultipartUploads(mpuBucketName, listingParams,
log, (err, mpuList) => { log, (err, mpuList) => {
if (err && !err.NoSuchBucket) { if (err && !err.is.NoSuchBucket) {
log.error('Error listing MPUs for Azure delete', log.error('Error listing MPUs for Azure delete',
{ error: err, dataStoreName }); { error: err, dataStoreName });
return cb(errors.ServiceUnavailable); return cb(errors.ServiceUnavailable);

View File

@ -85,7 +85,7 @@ function _retryDelete(objectGetInfo, log, count, cb) {
} }
return client.delete(objectGetInfo, log.getSerializedUids(), err => { return client.delete(objectGetInfo, log.getSerializedUids(), err => {
if (err) { if (err) {
if (err.ObjNotFound) { if (err.is.ObjNotFound) {
log.info('no such key in datastore', log.info('no such key in datastore',
{ objectGetInfo, implName, moreRetries: 'no' }); { objectGetInfo, implName, moreRetries: 'no' });
return cb(err); return cb(err);
@ -264,7 +264,7 @@ const data = {
return; return;
} }
_retryDelete(clientGetInfo, log, 0, err => { _retryDelete(clientGetInfo, log, 0, err => {
if (err && !err.ObjNotFound) { if (err && !err.is.ObjNotFound) {
log.error('delete error from datastore', log.error('delete error from datastore',
{ error: err, key: objectGetInfo.key, moreRetries: 'no' }); { error: err, key: objectGetInfo.key, moreRetries: 'no' });
} }

View File

@ -49,7 +49,7 @@ class BucketClientInterface {
getBucketAndObject(bucketName, objName, params, log, cb) { getBucketAndObject(bucketName, objName, params, log, cb) {
this.client.getBucketAndObject(bucketName, objName, this.client.getBucketAndObject(bucketName, objName,
log.getSerializedUids(), (err, data) => { log.getSerializedUids(), (err, data) => {
if (err && (!err.NoSuchKey && !err.ObjNotFound)) { if (err && (!err.is.NoSuchKey && !err.is.ObjNotFound)) {
return cb(err); return cb(err);
} }
return cb(null, JSON.parse(data)); return cb(null, JSON.parse(data));

View File

@ -83,7 +83,7 @@ class BucketFileInterface {
createBucket(bucketName, bucketMD, log, cb) { createBucket(bucketName, bucketMD, log, cb) {
this.getBucketAttributes(bucketName, log, err => { this.getBucketAttributes(bucketName, log, err => {
if (err && err !== errors.NoSuchBucket) { if (err && err !== errors.is.NoSuchBucket) {
return cb(err); return cb(err);
} }
if (err === undefined) { if (err === undefined) {
@ -101,7 +101,7 @@ class BucketFileInterface {
.withRequestLogger(log) .withRequestLogger(log)
.get(bucketName, {}, (err, data) => { .get(bucketName, {}, (err, data) => {
if (err) { if (err) {
if (err.ObjNotFound) { if (err.is.ObjNotFound) {
return cb(errors.NoSuchBucket); return cb(errors.NoSuchBucket);
} }
const logObj = { const logObj = {
@ -125,7 +125,7 @@ class BucketFileInterface {
db.withRequestLogger(log) db.withRequestLogger(log)
.get(objName, params, (err, objAttr) => { .get(objName, params, (err, objAttr) => {
if (err) { if (err) {
if (err.ObjNotFound) { if (err.is.ObjNotFound) {
return cb(null, { return cb(null, {
bucket: bucketAttr.serialize(), bucket: bucketAttr.serialize(),
}); });
@ -218,7 +218,7 @@ class BucketFileInterface {
} }
db.withRequestLogger(log).get(objName, params, (err, data) => { db.withRequestLogger(log).get(objName, params, (err, data) => {
if (err) { if (err) {
if (err.ObjNotFound) { if (err.is.ObjNotFound) {
return cb(errors.NoSuchKey); return cb(errors.NoSuchKey);
} }
const logObj = { const logObj = {

View File

@ -719,7 +719,7 @@ function batchDelete(request, response, log, callback) {
log.trace('batch delete locations', { locations }); log.trace('batch delete locations', { locations });
return async.eachLimit(locations, 5, (loc, next) => { return async.eachLimit(locations, 5, (loc, next) => {
data.delete(loc, log, err => { data.delete(loc, log, err => {
if (err && err.ObjNotFound) { if (err && err.is.ObjNotFound) {
log.info('batch delete: data location do not exist', { log.info('batch delete: data location do not exist', {
method: 'batchDelete', method: 'batchDelete',
location: loc, location: loc,

View File

@ -42,7 +42,7 @@ const services = {
// buckets to list. By returning an empty array, the // buckets to list. By returning an empty array, the
// getService API will just respond with the user info // getService API will just respond with the user info
// without listing any buckets. // without listing any buckets.
if (err && err.NoSuchBucket) { if (err && err.is.NoSuchBucket) {
log.trace('no buckets found'); log.trace('no buckets found');
// If we checked the old user bucket, that means we // If we checked the old user bucket, that means we
// already checked the new user bucket. If neither the // already checked the new user bucket. If neither the
@ -555,7 +555,7 @@ const services = {
// If the MPU was initiated, the mpu bucket should exist. // If the MPU was initiated, the mpu bucket should exist.
const mpuBucketName = `${constants.mpuBucketPrefix}${bucketName}`; const mpuBucketName = `${constants.mpuBucketPrefix}${bucketName}`;
metadata.getBucket(mpuBucketName, log, (err, mpuBucket) => { metadata.getBucket(mpuBucketName, log, (err, mpuBucket) => {
if (err && err.NoSuchBucket) { if (err && err.is.NoSuchBucket) {
log.debug('bucket not found in metadata', { error: err, log.debug('bucket not found in metadata', { error: err,
method: 'services.metadataValidateMultipart' }); method: 'services.metadataValidateMultipart' });
return cb(errors.NoSuchUpload); return cb(errors.NoSuchUpload);
@ -577,7 +577,7 @@ const services = {
metadata.getObjectMD(mpuBucket.getName(), mpuOverviewKey, metadata.getObjectMD(mpuBucket.getName(), mpuOverviewKey,
{}, log, (err, storedMetadata) => { {}, log, (err, storedMetadata) => {
if (err) { if (err) {
if (err.NoSuchKey) { if (err.is.NoSuchKey) {
return cb(errors.NoSuchUpload); return cb(errors.NoSuchUpload);
} }
log.error('error from metadata', { error: err }); log.error('error from metadata', { error: err });
@ -753,7 +753,7 @@ const services = {
assert.strictEqual(typeof bucketName, 'string'); assert.strictEqual(typeof bucketName, 'string');
const MPUBucketName = `${constants.mpuBucketPrefix}${bucketName}`; const MPUBucketName = `${constants.mpuBucketPrefix}${bucketName}`;
metadata.getBucket(MPUBucketName, log, (err, bucket) => { metadata.getBucket(MPUBucketName, log, (err, bucket) => {
if (err && err.NoSuchBucket) { if (err && err.is.NoSuchBucket) {
log.trace('no buckets found'); log.trace('no buckets found');
const creationDate = new Date().toJSON(); const creationDate = new Date().toJSON();
const mpuBucket = new BucketInfo(MPUBucketName, const mpuBucket = new BucketInfo(MPUBucketName,

View File

@ -20,7 +20,7 @@
"homepage": "https://github.com/scality/S3#readme", "homepage": "https://github.com/scality/S3#readme",
"dependencies": { "dependencies": {
"@hapi/joi": "^17.1.0", "@hapi/joi": "^17.1.0",
"arsenal": "github:scality/arsenal#7.10.9", "arsenal": "git+https://github.com/scality/arsenal#7.10.17",
"async": "~2.5.0", "async": "~2.5.0",
"aws-sdk": "2.905.0", "aws-sdk": "2.905.0",
"azure-storage": "^2.1.0", "azure-storage": "^2.1.0",

View File

@ -81,7 +81,7 @@ describe('aws-node-sdk test deleteBucketReplication', () => {
}), }),
next => deleteReplicationAndCheckResponse(bucket, next), next => deleteReplicationAndCheckResponse(bucket, next),
next => s3.getBucketReplication({ Bucket: bucket }, err => { next => s3.getBucketReplication({ Bucket: bucket }, err => {
assert(errors.ReplicationConfigurationNotFoundError[err.code]); assert(errors.is.ReplicationConfigurationNotFoundError);
return next(); return next();
}), }),
], done)); ], done));

View File

@ -45,7 +45,7 @@ describe('aws-node-sdk test getBucketReplication', () => {
it("should return 'ReplicationConfigurationNotFoundError' if bucket does " + it("should return 'ReplicationConfigurationNotFoundError' if bucket does " +
'not have a replication configuration', done => 'not have a replication configuration', done =>
s3.getBucketReplication({ Bucket: bucket }, err => { s3.getBucketReplication({ Bucket: bucket }, err => {
assert(errors.ReplicationConfigurationNotFoundError[err.code]); assert(errors.is.ReplicationConfigurationNotFoundError);
return done(); return done();
})); }));

View File

@ -71,7 +71,7 @@ describe('Healthcheck response', () => {
const azureLocationNonExistContainerError = const azureLocationNonExistContainerError =
results[azureLocationNonExistContainer].error; results[azureLocationNonExistContainer].error;
if (err) { if (err) {
assert.strictEqual(err, errors.InternalError, assert(err.is.InternalError,
`got unexpected err in clientCheck: ${err}`); `got unexpected err in clientCheck: ${err}`);
assert(azureLocationNonExistContainerError.startsWith( assert(azureLocationNonExistContainerError.startsWith(
'The specified container is being deleted.')); 'The specified container is being deleted.'));

View File

@ -513,7 +513,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
const fakeKey = `key-${Date.now()}`; const fakeKey = `key-${Date.now()}`;
const delParams = getDeleteParams(fakeKey, fakeUploadId); const delParams = getDeleteParams(fakeKey, fakeUploadId);
multipartDelete(authInfo, delParams, log, err => { multipartDelete(authInfo, delParams, log, err => {
assert.equal(err, errors.NoSuchUpload, assert(err.is.NoSuchUpload,
`Error aborting MPU: ${err}`); `Error aborting MPU: ${err}`);
done(); done();
}); });
@ -639,7 +639,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
const compParams = getCompleteParams(objectKey, uploadId); const compParams = getCompleteParams(objectKey, uploadId);
compParams.post = errorBody; compParams.post = errorBody;
completeMultipartUpload(authInfo, compParams, log, err => { completeMultipartUpload(authInfo, compParams, log, err => {
assert.deepStrictEqual(err, errors.InvalidPart); assert(err.is.InvalidPart);
done(); done();
}); });
}); });
@ -661,7 +661,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
const compParams = getCompleteParams(objectKey, uploadId); const compParams = getCompleteParams(objectKey, uploadId);
compParams.post = errorBody; compParams.post = errorBody;
completeMultipartUpload(authInfo, compParams, log, err => { completeMultipartUpload(authInfo, compParams, log, err => {
assert.deepStrictEqual(err, errors.InvalidPartOrder); assert(err.is.InvalidPartOrder);
done(); done();
}); });
}); });
@ -687,7 +687,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
const compParams = getCompleteParams(objectKey, uploadId); const compParams = getCompleteParams(objectKey, uploadId);
compParams.post = errorBody; compParams.post = errorBody;
completeMultipartUpload(authInfo, compParams, log, err => { completeMultipartUpload(authInfo, compParams, log, err => {
assert.deepStrictEqual(err, errors.EntityTooSmall); assert(err.is.EntityTooSmall);
done(); done();
}); });
}); });
@ -825,7 +825,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
(uploadId, next) => { (uploadId, next) => {
const listParams = getListParams(objectKey, uploadId); const listParams = getListParams(objectKey, uploadId);
listParts(authInfo, listParams, log, err => { listParts(authInfo, listParams, log, err => {
assert(err.NoSuchUpload); assert(err.is.NoSuchUpload);
next(); next();
}); });
}, },

View File

@ -58,7 +58,7 @@ function put(bucketLoc, objLoc, requestHost, cb, errorDescription) {
resHeaders) => { resHeaders) => {
if (errorDescription) { if (errorDescription) {
assert.strictEqual(err.code, 400); assert.strictEqual(err.code, 400);
assert(err.InvalidArgument); assert(err.is.InvalidArgument);
assert(err.description.indexOf(errorDescription) > -1); assert(err.description.indexOf(errorDescription) > -1);
} else { } else {
assert.strictEqual(err, null, `Error putting object: ${err}`); assert.strictEqual(err, null, `Error putting object: ${err}`);

View File

@ -99,7 +99,7 @@ errorDescription) {
(err, json) => { (err, json) => {
if (errorDescription) { if (errorDescription) {
assert.strictEqual(err.code, 400); assert.strictEqual(err.code, 400);
assert(err.InvalidArgument); assert(err.is.InvalidArgument);
assert(err.description.indexOf(errorDescription) > -1); assert(err.description.indexOf(errorDescription) > -1);
return cb(); return cb();
} }

View File

@ -37,7 +37,8 @@ describe('objectLockHelpers: validateHeaders', () => {
= validateHeaders(objLockDisabledBucketInfo, headers, log); = validateHeaders(objLockDisabledBucketInfo, headers, log);
const expectedError = errors.InvalidRequest.customizeDescription( const expectedError = errors.InvalidRequest.customizeDescription(
'Bucket is missing ObjectLockConfiguration'); 'Bucket is missing ObjectLockConfiguration');
assert.strictEqual(objectLockValidationError.InvalidRequest, true); assert.strictEqual(
objectLockValidationError.is.InvalidRequest, true);
assert.strictEqual(objectLockValidationError.description, assert.strictEqual(objectLockValidationError.description,
expectedError.description); expectedError.description);
}); });
@ -90,7 +91,8 @@ describe('objectLockHelpers: validateHeaders', () => {
const expectedError = errors.InvalidArgument.customizeDescription( const expectedError = errors.InvalidArgument.customizeDescription(
'x-amz-object-lock-retain-until-date and x-amz-object-lock-mode ' + 'x-amz-object-lock-retain-until-date and x-amz-object-lock-mode ' +
'must both be supplied'); 'must both be supplied');
assert.strictEqual(objectLockValidationError.InvalidArgument, true); assert.strictEqual(
objectLockValidationError.is.InvalidArgument, true);
assert.strictEqual(objectLockValidationError.description, assert.strictEqual(objectLockValidationError.description,
expectedError.description); expectedError.description);
}); });
@ -104,7 +106,8 @@ describe('objectLockHelpers: validateHeaders', () => {
const expectedError = errors.InvalidArgument.customizeDescription( const expectedError = errors.InvalidArgument.customizeDescription(
'x-amz-object-lock-retain-until-date and x-amz-object-lock-mode ' + 'x-amz-object-lock-retain-until-date and x-amz-object-lock-mode ' +
'must both be supplied'); 'must both be supplied');
assert.strictEqual(objectLockValidationError.InvalidArgument, true); assert.strictEqual(
objectLockValidationError.is.InvalidArgument, true);
assert.strictEqual(objectLockValidationError.description, assert.strictEqual(objectLockValidationError.description,
expectedError.description); expectedError.description);
}); });
@ -118,7 +121,8 @@ describe('objectLockHelpers: validateHeaders', () => {
'The retain until date must be in the future!'); 'The retain until date must be in the future!');
const objectLockValidationError const objectLockValidationError
= validateHeaders(bucketInfo, headers, log); = validateHeaders(bucketInfo, headers, log);
assert.strictEqual(objectLockValidationError.InvalidArgument, true); assert.strictEqual(
objectLockValidationError.is.InvalidArgument, true);
assert.strictEqual(objectLockValidationError.description, assert.strictEqual(objectLockValidationError.description,
expectedError.description); expectedError.description);
}); });
@ -131,7 +135,8 @@ describe('objectLockHelpers: validateHeaders', () => {
= validateHeaders(bucketInfo, headers, log); = validateHeaders(bucketInfo, headers, log);
const expectedError = errors.InvalidArgument.customizeDescription( const expectedError = errors.InvalidArgument.customizeDescription(
'Legal hold status must be one of "ON", "OFF"'); 'Legal hold status must be one of "ON", "OFF"');
assert.strictEqual(objectLockValidationError.InvalidArgument, true); assert.strictEqual(
objectLockValidationError.is.InvalidArgument, true);
assert.strictEqual(objectLockValidationError.description, assert.strictEqual(objectLockValidationError.description,
expectedError.description); expectedError.description);
}); });
@ -145,7 +150,8 @@ describe('objectLockHelpers: validateHeaders', () => {
= validateHeaders(bucketInfo, headers, log); = validateHeaders(bucketInfo, headers, log);
const expectedError = errors.InvalidArgument.customizeDescription( const expectedError = errors.InvalidArgument.customizeDescription(
'Unknown wormMode directive'); 'Unknown wormMode directive');
assert.strictEqual(objectLockValidationError.InvalidArgument, true); assert.strictEqual(
objectLockValidationError.is.InvalidArgument, true);
assert.strictEqual(objectLockValidationError.description, assert.strictEqual(objectLockValidationError.description,
expectedError.description); expectedError.description);
}); });
@ -207,7 +213,7 @@ describe('objectLockHelpers: validateObjectLockUpdate', () => {
}; };
const error = validateObjectLockUpdate(objMD, retentionInfo, false); const error = validateObjectLockUpdate(objMD, retentionInfo, false);
assert.deepStrictEqual(error, errors.AccessDenied); assert.strictEqual(error.is.AccessDenied, true);
}); });
it('should disallow COMPLIANCE => GOVERNANCE if retention is not expired', () => { it('should disallow COMPLIANCE => GOVERNANCE if retention is not expired', () => {
@ -222,7 +228,7 @@ describe('objectLockHelpers: validateObjectLockUpdate', () => {
}; };
const error = validateObjectLockUpdate(objMD, retentionInfo); const error = validateObjectLockUpdate(objMD, retentionInfo);
assert.deepStrictEqual(error, errors.AccessDenied); assert.strictEqual(error.is.AccessDenied, true);
}); });
it('should allow COMPLIANCE => GOVERNANCE if retention is expired', () => { it('should allow COMPLIANCE => GOVERNANCE if retention is expired', () => {
@ -267,7 +273,7 @@ describe('objectLockHelpers: validateObjectLockUpdate', () => {
}; };
const error = validateObjectLockUpdate(objMD, retentionInfo); const error = validateObjectLockUpdate(objMD, retentionInfo);
assert.deepStrictEqual(error, errors.AccessDenied); assert.strictEqual(error.is.AccessDenied, true);
}); });
it('should allow shortening retention period if in GOVERNANCE', () => { it('should allow shortening retention period if in GOVERNANCE', () => {

View File

@ -112,7 +112,7 @@ describe('bucketDelete API', () => {
objectPut(authInfo, testPutObjectRequest, undefined, log, err => { objectPut(authInfo, testPutObjectRequest, undefined, log, err => {
assert.strictEqual(err, null); assert.strictEqual(err, null);
bucketDelete(authInfo, testRequest, log, err => { bucketDelete(authInfo, testRequest, log, err => {
assert.deepStrictEqual(err, errors.BucketNotEmpty); assert(err.is.BucketNotEmpty);
metadata.getBucket(bucketName, log, (err, md) => { metadata.getBucket(bucketName, log, (err, md) => {
assert.strictEqual(md.getName(), bucketName); assert.strictEqual(md.getName(), bucketName);
metadata.listObject(usersBucket, metadata.listObject(usersBucket,
@ -146,7 +146,7 @@ describe('bucketDelete API', () => {
bucketPut(authInfo, testRequest, log, () => { bucketPut(authInfo, testRequest, log, () => {
bucketDelete(authInfo, testRequest, log, () => { bucketDelete(authInfo, testRequest, log, () => {
metadata.getBucket(bucketName, log, (err, md) => { metadata.getBucket(bucketName, log, (err, md) => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert(err.is.NoSuchBucket);
assert.strictEqual(md, undefined); assert.strictEqual(md, undefined);
metadata.listObject(usersBucket, { prefix: canonicalID }, metadata.listObject(usersBucket, { prefix: canonicalID },
log, (err, listResponse) => { log, (err, listResponse) => {
@ -169,7 +169,7 @@ describe('bucketDelete API', () => {
it('should prevent anonymous user delete bucket API access', done => { it('should prevent anonymous user delete bucket API access', done => {
const publicAuthInfo = makeAuthInfo(constants.publicId); const publicAuthInfo = makeAuthInfo(constants.publicId);
bucketDelete(publicAuthInfo, testRequest, log, err => { bucketDelete(publicAuthInfo, testRequest, log, err => {
assert.deepStrictEqual(err, errors.AccessDenied); assert(err.is.AccessDenied);
done(); done();
}); });
}); });

View File

@ -199,7 +199,7 @@ describe('bucketGet API', () => {
const testGetRequest = Object.assign({ query: { 'max-keys': '-1' } }, const testGetRequest = Object.assign({ query: { 'max-keys': '-1' } },
baseGetRequest); baseGetRequest);
bucketGet(authInfo, testGetRequest, log, err => { bucketGet(authInfo, testGetRequest, log, err => {
assert.deepStrictEqual(err, errors.InvalidArgument); assert(err.is.InvalidArgument);
done(); done();
}); });
}); });

View File

@ -28,7 +28,7 @@ describe('getBucketLifecycle API', () => {
'bucket has no lifecycle', done => { 'bucket has no lifecycle', done => {
const lifecycleRequest = getLifecycleRequest(bucketName); const lifecycleRequest = getLifecycleRequest(bucketName);
bucketGetLifecycle(authInfo, lifecycleRequest, log, err => { bucketGetLifecycle(authInfo, lifecycleRequest, log, err => {
assert.strictEqual(err.NoSuchLifecycleConfiguration, true); assert.strictEqual(err.is.NoSuchLifecycleConfiguration, true);
done(); done();
}); });
}); });

View File

@ -74,7 +74,7 @@ describe('bucketGetObjectLock API', () => {
'object lock is not enabled on the bucket', done => { 'object lock is not enabled on the bucket', done => {
const objectLockRequest = getObjectLockConfigRequest(bucketName); const objectLockRequest = getObjectLockConfigRequest(bucketName);
bucketGetObjectLock(authInfo, objectLockRequest, log, err => { bucketGetObjectLock(authInfo, objectLockRequest, log, err => {
assert.strictEqual(err.ObjectLockConfigurationNotFoundError, true); assert.strictEqual(err.is.ObjectLockConfigurationNotFoundError, true);
done(); done();
}); });
}); });

View File

@ -44,7 +44,7 @@ describe('getBucketPolicy API', () => {
it('should return NoSuchBucketPolicy error if ' + it('should return NoSuchBucketPolicy error if ' +
'bucket has no policy', done => { 'bucket has no policy', done => {
bucketGetPolicy(authInfo, testBasicRequest, log, err => { bucketGetPolicy(authInfo, testBasicRequest, log, err => {
assert.strictEqual(err.NoSuchBucketPolicy, true); assert.strictEqual(err.is.NoSuchBucketPolicy, true);
done(); done();
}); });
}); });

View File

@ -22,7 +22,7 @@ describe('bucketHead API', () => {
it('should return an error if the bucket does not exist', done => { it('should return an error if the bucket does not exist', done => {
bucketHead(authInfo, testRequest, log, err => { bucketHead(authInfo, testRequest, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -31,7 +31,7 @@ describe('bucketHead API', () => {
const otherAuthInfo = makeAuthInfo('accessKey2'); const otherAuthInfo = makeAuthInfo('accessKey2');
bucketPut(otherAuthInfo, testRequest, log, () => { bucketPut(otherAuthInfo, testRequest, log, () => {
bucketHead(authInfo, testRequest, log, err => { bucketHead(authInfo, testRequest, log, err => {
assert.deepStrictEqual(err, errors.AccessDenied); assert.strictEqual(err.is.AccessDenied, true);
done(); done();
}); });
}); });

View File

@ -105,7 +105,7 @@ describe('bucketPut API', () => {
bucketPut(authInfo, testRequest, log, () => { bucketPut(authInfo, testRequest, log, () => {
bucketPut(otherAuthInfo, testRequest, bucketPut(otherAuthInfo, testRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.BucketAlreadyExists); assert.strictEqual(err.is.BucketAlreadyExists);
done(); done();
}); });
}); });
@ -188,9 +188,9 @@ describe('bucketPut API', () => {
post: '', post: '',
}; };
bucketPut(authInfo, testRequest, log, err => { bucketPut(authInfo, testRequest, log, err => {
assert.deepStrictEqual(err, errors.InvalidArgument); assert.strictEqual(err.is.InvalidArgument, true);
metadata.getBucket(bucketName, log, err => { metadata.getBucket(bucketName, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -209,9 +209,9 @@ describe('bucketPut API', () => {
post: '', post: '',
}; };
bucketPut(authInfo, testRequest, log, err => { bucketPut(authInfo, testRequest, log, err => {
assert.deepStrictEqual(err, errors.InvalidArgument); assert.strictEqual(err.is.InvalidArgument, true);
metadata.getBucket(bucketName, log, err => { metadata.getBucket(bucketName, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -231,9 +231,9 @@ describe('bucketPut API', () => {
post: '', post: '',
}; };
bucketPut(authInfo, testRequest, log, err => { bucketPut(authInfo, testRequest, log, err => {
assert.deepStrictEqual(err, errors.UnresolvableGrantByEmailAddress); assert.strictEqual(err.is.UnresolvableGrantByEmailAddress, true);
metadata.getBucket(bucketName, log, err => { metadata.getBucket(bucketName, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.deepStrictEqual(err, errors.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -309,7 +309,7 @@ describe('bucketPut API', () => {
it('should prevent anonymous user from accessing putBucket API', done => { it('should prevent anonymous user from accessing putBucket API', done => {
const publicAuthInfo = makeAuthInfo(constants.publicId); const publicAuthInfo = makeAuthInfo(constants.publicId);
bucketPut(publicAuthInfo, testRequest, log, err => { bucketPut(publicAuthInfo, testRequest, log, err => {
assert.deepStrictEqual(err, errors.AccessDenied); assert.strictEqual(err.is.AccessDenied, true);
}); });
done(); done();
}); });

View File

@ -75,7 +75,7 @@ describe('putBucketACL API', () => {
}; };
bucketPutACL(authInfo, testACLRequest, log, err => { bucketPutACL(authInfo, testACLRequest, log, err => {
assert.deepStrictEqual(err, errors.InvalidArgument); assert.strictEqual(err.is.InvalidArgument, true);
done(); done();
}); });
}); });
@ -273,7 +273,7 @@ describe('putBucketACL API', () => {
query: { acl: '' }, query: { acl: '' },
}; };
return bucketPutACL(authInfo, testACLRequest, log, err => { return bucketPutACL(authInfo, testACLRequest, log, err => {
assert.deepStrictEqual(err, errors.InvalidArgument); assert.strictEqual(err.is.InvalidArgument, true);
done(); done();
}); });
}); });
@ -295,7 +295,7 @@ describe('putBucketACL API', () => {
}; };
bucketPutACL(authInfo, testACLRequest, log, err => { bucketPutACL(authInfo, testACLRequest, log, err => {
assert.deepStrictEqual(err, errors.UnresolvableGrantByEmailAddress); assert.strictEqual(err.is.UnresolvableGrantByEmailAddress, true);
done(); done();
}); });
}); });
@ -421,7 +421,7 @@ describe('putBucketACL API', () => {
}; };
bucketPutACL(authInfo, testACLRequest, log, err => { bucketPutACL(authInfo, testACLRequest, log, err => {
assert.deepStrictEqual(err, errors.MalformedACLError); assert.strictEqual(err.is.MalformedACLError, true);
done(); done();
}); });
}); });
@ -464,7 +464,7 @@ describe('putBucketACL API', () => {
}; };
bucketPutACL(authInfo, testACLRequest, log, err => { bucketPutACL(authInfo, testACLRequest, log, err => {
assert.deepStrictEqual(err, errors.MalformedACLError); assert.strictEqual(err.is.MalformedACLError, true);
done(); done();
}); });
}); });
@ -496,7 +496,7 @@ describe('putBucketACL API', () => {
}; };
return bucketPutACL(authInfo, testACLRequest, log, err => { return bucketPutACL(authInfo, testACLRequest, log, err => {
assert.deepStrictEqual(err, errors.InvalidArgument); assert.strictEqual(err.is.InvalidArgument, true);
done(); done();
}); });
}); });
@ -527,7 +527,7 @@ describe('putBucketACL API', () => {
query: { acl: '' }, query: { acl: '' },
}; };
bucketPutACL(authInfo, testACLRequest, log, err => { bucketPutACL(authInfo, testACLRequest, log, err => {
assert.deepStrictEqual(err, errors.UnresolvableGrantByEmailAddress); assert.strictEqual(err.is.UnresolvableGrantByEmailAddress, true);
done(); done();
}); });
}); });
@ -563,7 +563,7 @@ describe('putBucketACL API', () => {
}; };
bucketPutACL(authInfo, testACLRequest, log, err => { bucketPutACL(authInfo, testACLRequest, log, err => {
assert.deepStrictEqual(err, errors.MalformedACLError); assert.strictEqual(err.is.MalformedACLError, true);
done(); done();
}); });
}); });
@ -608,7 +608,7 @@ describe('putBucketACL API', () => {
}; };
bucketPutACL(authInfo, testACLRequest, log, err => { bucketPutACL(authInfo, testACLRequest, log, err => {
assert.deepStrictEqual(err, errors.MalformedACLError); assert.strictEqual(err.is.MalformedACLError, true);
done(); done();
}); });
}); });
@ -643,7 +643,7 @@ describe('putBucketACL API', () => {
}; };
bucketPutACL(authInfo, testACLRequest, log, err => { bucketPutACL(authInfo, testACLRequest, log, err => {
assert.deepStrictEqual(err, errors.MalformedXML); assert.strictEqual(err.is.MalformedXML, true);
done(); done();
}); });
}); });
@ -677,7 +677,7 @@ describe('putBucketACL API', () => {
}; };
bucketPutACL(authInfo, testACLRequest, log, err => { bucketPutACL(authInfo, testACLRequest, log, err => {
assert.deepStrictEqual(err, errors.InvalidArgument); assert.strictEqual(err.is.InvalidArgument, true);
done(); done();
}); });
}); });
@ -698,7 +698,7 @@ describe('putBucketACL API', () => {
}; };
bucketPutACL(authInfo, testACLRequest, log, err => { bucketPutACL(authInfo, testACLRequest, log, err => {
assert.deepStrictEqual(err, errors.InvalidArgument); assert.strictEqual(err.is.InvalidArgument, true);
done(); done();
}); });
}); });

View File

@ -129,7 +129,7 @@ describe('PUT bucket cors :: helper validation functions ', () => {
`<ID>${testValue}</ID>`); `<ID>${testValue}</ID>`);
parseCorsXml(xml, log, err => { parseCorsXml(xml, log, err => {
assert(err, 'Expected error but found none'); assert(err, 'Expected error but found none');
assert.deepStrictEqual(err, errors.MalformedXML); assert.strictEqual(err.is.MalformedXML, true);
return done(); return done();
}); });
}); });
@ -175,7 +175,7 @@ describe('PUT bucket cors :: helper validation functions ', () => {
`<MaxAgeSeconds>${testValue}</MaxAgeSeconds>`); `<MaxAgeSeconds>${testValue}</MaxAgeSeconds>`);
parseCorsXml(xml, log, err => { parseCorsXml(xml, log, err => {
assert(err, 'Expected error but found none'); assert(err, 'Expected error but found none');
assert.deepStrictEqual(err, errors.MalformedXML); assert.strictEqual(err.is.MalformedXML, true);
return done(); return done();
}); });
}); });

View File

@ -25,7 +25,7 @@ describe('bucketPutEncryption API', () => {
describe('test invalid sse configs', () => { describe('test invalid sse configs', () => {
it('should reject an empty config', done => { it('should reject an empty config', done => {
bucketPutEncryption(authInfo, templateRequest(bucketName, { post: '' }), log, err => { bucketPutEncryption(authInfo, templateRequest(bucketName, { post: '' }), log, err => {
assert.strictEqual(err.MalformedXML, true); assert.strictEqual(err.is.MalformedXML, true);
done(); done();
}); });
}); });
@ -36,7 +36,7 @@ describe('bucketPutEncryption API', () => {
<ServerSideEncryptionConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <ServerSideEncryptionConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
</ServerSideEncryptionConfiguration>`, </ServerSideEncryptionConfiguration>`,
}), log, err => { }), log, err => {
assert.strictEqual(err.MalformedXML, true); assert.strictEqual(err.is.MalformedXML, true);
done(); done();
}); });
}); });
@ -48,7 +48,7 @@ describe('bucketPutEncryption API', () => {
<Rule></Rule> <Rule></Rule>
</ServerSideEncryptionConfiguration>`, </ServerSideEncryptionConfiguration>`,
}), log, err => { }), log, err => {
assert.strictEqual(err.MalformedXML, true); assert.strictEqual(err.is.MalformedXML, true);
done(); done();
}); });
}); });
@ -56,7 +56,7 @@ describe('bucketPutEncryption API', () => {
it('should reject a config with no SSEAlgorithm', done => { it('should reject a config with no SSEAlgorithm', done => {
const post = templateSSEConfig({}); const post = templateSSEConfig({});
bucketPutEncryption(authInfo, templateRequest(bucketName, { post }), log, err => { bucketPutEncryption(authInfo, templateRequest(bucketName, { post }), log, err => {
assert.strictEqual(err.MalformedXML, true); assert.strictEqual(err.is.MalformedXML, true);
done(); done();
}); });
}); });
@ -64,7 +64,7 @@ describe('bucketPutEncryption API', () => {
it('should reject a config with an invalid SSEAlgorithm', done => { it('should reject a config with an invalid SSEAlgorithm', done => {
const post = templateSSEConfig({ algorithm: 'InvalidAlgo' }); const post = templateSSEConfig({ algorithm: 'InvalidAlgo' });
bucketPutEncryption(authInfo, templateRequest(bucketName, { post }), log, err => { bucketPutEncryption(authInfo, templateRequest(bucketName, { post }), log, err => {
assert.strictEqual(err.MalformedXML, true); assert.strictEqual(err.is.MalformedXML, true);
done(); done();
}); });
}); });
@ -72,7 +72,7 @@ describe('bucketPutEncryption API', () => {
it('should reject a config with SSEAlgorithm == AES256 and a provided KMSMasterKeyID', done => { it('should reject a config with SSEAlgorithm == AES256 and a provided KMSMasterKeyID', done => {
const post = templateSSEConfig({ algorithm: 'AES256', keyId: '12345' }); const post = templateSSEConfig({ algorithm: 'AES256', keyId: '12345' });
bucketPutEncryption(authInfo, templateRequest(bucketName, { post }), log, err => { bucketPutEncryption(authInfo, templateRequest(bucketName, { post }), log, err => {
assert.strictEqual(err.InvalidArgument, true); assert.strictEqual(err.is.InvalidArgument, true);
done(); done();
}); });
}); });

View File

@ -48,7 +48,7 @@ describe('putBucketObjectLock API', () => {
it('should return InvalidBucketState error', done => { it('should return InvalidBucketState error', done => {
bucketPutObjectLock(authInfo, putObjLockRequest, log, err => { bucketPutObjectLock(authInfo, putObjLockRequest, log, err => {
assert.strictEqual(err.InvalidBucketState, true); assert.strictEqual(err.is.InvalidBucketState, true);
done(); done();
}); });
}); });

View File

@ -70,7 +70,7 @@ describe('putBucketPolicy API', () => {
expectedBucketPolicy.Statement[0].Resource = 'arn:aws::s3:::badname'; expectedBucketPolicy.Statement[0].Resource = 'arn:aws::s3:::badname';
bucketPutPolicy(authInfo, getPolicyRequest(expectedBucketPolicy), bucketPutPolicy(authInfo, getPolicyRequest(expectedBucketPolicy),
log, err => { log, err => {
assert.strictEqual(err.MalformedPolicy, true); assert.strictEqual(err.is.MalformedPolicy, true);
assert.strictEqual(err.description, 'Policy has invalid resource'); assert.strictEqual(err.description, 'Policy has invalid resource');
return done(); return done();
}); });
@ -81,7 +81,7 @@ describe('putBucketPolicy API', () => {
{ StringEquals: { 's3:x-amz-acl': ['public-read'] } }; { StringEquals: { 's3:x-amz-acl': ['public-read'] } };
bucketPutPolicy(authInfo, getPolicyRequest(expectedBucketPolicy), log, bucketPutPolicy(authInfo, getPolicyRequest(expectedBucketPolicy), log,
err => { err => {
assert.strictEqual(err.NotImplemented, true); assert.strictEqual(err.is.NotImplemented, true);
done(); done();
}); });
}); });
@ -90,7 +90,7 @@ describe('putBucketPolicy API', () => {
expectedBucketPolicy.Statement[0].Principal = { Service: ['test.com'] }; expectedBucketPolicy.Statement[0].Principal = { Service: ['test.com'] };
bucketPutPolicy(authInfo, getPolicyRequest(expectedBucketPolicy), log, bucketPutPolicy(authInfo, getPolicyRequest(expectedBucketPolicy), log,
err => { err => {
assert.strictEqual(err.NotImplemented, true); assert.strictEqual(err.is.NotImplemented, true);
done(); done();
}); });
}); });
@ -100,7 +100,7 @@ describe('putBucketPolicy API', () => {
{ Federated: 'www.test.com' }; { Federated: 'www.test.com' };
bucketPutPolicy(authInfo, getPolicyRequest(expectedBucketPolicy), log, bucketPutPolicy(authInfo, getPolicyRequest(expectedBucketPolicy), log,
err => { err => {
assert.strictEqual(err.NotImplemented, true); assert.strictEqual(err.is.NotImplemented, true);
done(); done();
}); });
}); });

View File

@ -96,7 +96,7 @@ function confirmDeleted(done) {
process.nextTick(() => { process.nextTick(() => {
process.nextTick(() => { process.nextTick(() => {
metadata.getBucket(bucketName, log, err => { metadata.getBucket(bucketName, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
return checkBucketListing(authInfo, bucketName, 0, done); return checkBucketListing(authInfo, bucketName, 0, done);
}); });
}); });
@ -138,7 +138,7 @@ describe('deleted flag bucket handling', () => {
'different account sends put bucket request for bucket with ' + 'different account sends put bucket request for bucket with ' +
'deleted flag', done => { 'deleted flag', done => {
bucketPut(otherAccountAuthInfo, baseTestRequest, log, err => { bucketPut(otherAccountAuthInfo, baseTestRequest, log, err => {
assert.deepStrictEqual(err, errors.BucketAlreadyExists); assert.strictEqual(err.is.BucketAlreadyExists, true);
metadata.getBucket(bucketName, log, (err, data) => { metadata.getBucket(bucketName, log, (err, data) => {
assert.strictEqual(data._transient, false); assert.strictEqual(data._transient, false);
assert.strictEqual(data._deleted, true); assert.strictEqual(data._deleted, true);
@ -193,7 +193,7 @@ describe('deleted flag bucket handling', () => {
'x-amz-acl': 'public-read' }, 'headers', 'x-amz-acl': 'public-read' }, 'headers',
baseTestRequest, baseTestRequest.headers); baseTestRequest, baseTestRequest.headers);
bucketPutACL(otherAccountAuthInfo, putACLRequest, log, err => { bucketPutACL(otherAccountAuthInfo, putACLRequest, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
metadata.getBucket(bucketName, log, (err, data) => { metadata.getBucket(bucketName, log, (err, data) => {
assert.strictEqual(data._deleted, true); assert.strictEqual(data._deleted, true);
assert.strictEqual(data._transient, false); assert.strictEqual(data._transient, false);
@ -212,7 +212,7 @@ describe('deleted flag bucket handling', () => {
baseTestRequest, baseTestRequest.headers); baseTestRequest, baseTestRequest.headers);
const unauthorizedAccount = makeAuthInfo('keepMeOut'); const unauthorizedAccount = makeAuthInfo('keepMeOut');
bucketPutACL(unauthorizedAccount, putACLRequest, log, err => { bucketPutACL(unauthorizedAccount, putACLRequest, log, err => {
assert.deepStrictEqual(err, errors.AccessDenied); assert.strictEqual(err.is.AccessDenied, true);
metadata.getBucket(bucketName, log, (err, data) => { metadata.getBucket(bucketName, log, (err, data) => {
assert.strictEqual(data._deleted, true); assert.strictEqual(data._deleted, true);
assert.strictEqual(data._transient, false); assert.strictEqual(data._transient, false);
@ -266,7 +266,7 @@ describe('deleted flag bucket handling', () => {
const postBody = Buffer.from('I am a body', 'utf8'); const postBody = Buffer.from('I am a body', 'utf8');
const putObjRequest = new DummyRequest(setUpRequest, postBody); const putObjRequest = new DummyRequest(setUpRequest, postBody);
objectPut(otherAccountAuthInfo, putObjRequest, undefined, log, err => { objectPut(otherAccountAuthInfo, putObjRequest, undefined, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -314,7 +314,7 @@ describe('deleted flag bucket handling', () => {
initiateRequest.objectKey = 'objectName'; initiateRequest.objectKey = 'objectName';
initiateMultipartUpload(otherAccountAuthInfo, initiateRequest, log, initiateMultipartUpload(otherAccountAuthInfo, initiateRequest, log,
err => { err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -331,7 +331,7 @@ describe('deleted flag bucket handling', () => {
'authorized', done => { 'authorized', done => {
bucketDelete(otherAccountAuthInfo, baseTestRequest, bucketDelete(otherAccountAuthInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.AccessDenied); assert.strictEqual(err.is.AccessDenied, true);
done(); done();
}); });
}); });
@ -340,7 +340,7 @@ describe('deleted flag bucket handling', () => {
'NoSuchBucket error and complete deletion', done => { 'NoSuchBucket error and complete deletion', done => {
bucketDeleteWebsite(authInfo, baseTestRequest, bucketDeleteWebsite(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });
@ -349,7 +349,7 @@ describe('deleted flag bucket handling', () => {
'NoSuchBucket error and complete deletion', done => { 'NoSuchBucket error and complete deletion', done => {
bucketGet(authInfo, baseTestRequest, bucketGet(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });
@ -358,7 +358,7 @@ describe('deleted flag bucket handling', () => {
'NoSuchBucket error and complete deletion', done => { 'NoSuchBucket error and complete deletion', done => {
bucketGetACL(authInfo, baseTestRequest, bucketGetACL(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });
@ -367,7 +367,7 @@ describe('deleted flag bucket handling', () => {
'NoSuchBucket error and complete deletion', done => { 'NoSuchBucket error and complete deletion', done => {
bucketGetCors(authInfo, baseTestRequest, bucketGetCors(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });
@ -383,7 +383,7 @@ describe('deleted flag bucket handling', () => {
bucketPutCorsRequest.headers['content-md5'] = crypto.createHash('md5') bucketPutCorsRequest.headers['content-md5'] = crypto.createHash('md5')
.update(bucketPutCorsRequest.post, 'utf8').digest('base64'); .update(bucketPutCorsRequest.post, 'utf8').digest('base64');
bucketPutCors(authInfo, bucketPutCorsRequest, log, err => { bucketPutCors(authInfo, bucketPutCorsRequest, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });
@ -391,7 +391,7 @@ describe('deleted flag bucket handling', () => {
it('bucketDeleteCors request on bucket with delete flag should return ' + it('bucketDeleteCors request on bucket with delete flag should return ' +
'NoSuchBucket error and complete deletion', done => { 'NoSuchBucket error and complete deletion', done => {
bucketDeleteCors(authInfo, baseTestRequest, log, err => { bucketDeleteCors(authInfo, baseTestRequest, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });
@ -400,7 +400,7 @@ describe('deleted flag bucket handling', () => {
'NoSuchBucket error and complete deletion', done => { 'NoSuchBucket error and complete deletion', done => {
bucketGetWebsite(authInfo, baseTestRequest, bucketGetWebsite(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });
@ -414,7 +414,7 @@ describe('deleted flag bucket handling', () => {
'</WebsiteConfiguration>'; '</WebsiteConfiguration>';
bucketPutWebsite(authInfo, bucketPutWebsiteRequest, bucketPutWebsite(authInfo, bucketPutWebsiteRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });
@ -423,7 +423,7 @@ describe('deleted flag bucket handling', () => {
'NoSuchBucket error and complete deletion', done => { 'NoSuchBucket error and complete deletion', done => {
bucketHead(authInfo, baseTestRequest, bucketHead(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });
@ -438,13 +438,13 @@ describe('deleted flag bucket handling', () => {
if (extraArgNeeded) { if (extraArgNeeded) {
return apiAction(authInfo, mpuRequest, undefined, return apiAction(authInfo, mpuRequest, undefined,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchUpload); assert.strictEqual(err.is.NoSuchUpload, true);
return done(); return done();
}); });
} }
return apiAction(authInfo, mpuRequest, return apiAction(authInfo, mpuRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchUpload); assert.strictEqual(err.is.NoSuchUpload, true);
return done(); return done();
}); });
} }
@ -495,7 +495,7 @@ describe('deleted flag bucket handling', () => {
listRequest.query = {}; listRequest.query = {};
listMultipartUploads(authInfo, listRequest, listMultipartUploads(authInfo, listRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -505,7 +505,7 @@ describe('deleted flag bucket handling', () => {
done => { done => {
objectGet(authInfo, baseTestRequest, false, objectGet(authInfo, baseTestRequest, false,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });
@ -514,7 +514,7 @@ describe('deleted flag bucket handling', () => {
'NoSuchBucket error and complete deletion', done => { 'NoSuchBucket error and complete deletion', done => {
objectGetACL(authInfo, baseTestRequest, objectGetACL(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });
@ -523,7 +523,7 @@ describe('deleted flag bucket handling', () => {
'NoSuchBucket error and complete deletion', done => { 'NoSuchBucket error and complete deletion', done => {
objectHead(authInfo, baseTestRequest, objectHead(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });
@ -532,7 +532,7 @@ describe('deleted flag bucket handling', () => {
'NoSuchBucket error and complete deletion', done => { 'NoSuchBucket error and complete deletion', done => {
objectPutACL(authInfo, baseTestRequest, objectPutACL(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });
@ -541,7 +541,7 @@ describe('deleted flag bucket handling', () => {
'NoSuchBucket error', done => { 'NoSuchBucket error', done => {
objectDelete(authInfo, baseTestRequest, objectDelete(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
confirmDeleted(done); confirmDeleted(done);
}); });
}); });

View File

@ -126,7 +126,7 @@ describe('Multipart Delete API', () => {
'exist and legacyAwsBehavior set to true', 'exist and legacyAwsBehavior set to true',
done => { done => {
_createAndAbortMpu(true, true, eastLocation, err => { _createAndAbortMpu(true, true, eastLocation, err => {
assert.strictEqual(err, errors.NoSuchUpload, assert.strictEqual(err.is.NoSuchUpload, true,
`Expected NoSuchUpload, got ${err}`); `Expected NoSuchUpload, got ${err}`);
done(); done();
}); });

View File

@ -168,7 +168,7 @@ describe('Multipart Upload API', () => {
'no destination bucket', done => { 'no destination bucket', done => {
initiateMultipartUpload(authInfo, initiateRequest, initiateMultipartUpload(authInfo, initiateRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -315,7 +315,7 @@ describe('Multipart Upload API', () => {
}, postBody); }, postBody);
objectPutPart(authInfo, partRequest, undefined, log, objectPutPart(authInfo, partRequest, undefined, log,
(err, result) => { (err, result) => {
assert.deepStrictEqual(err, errors.TooManyParts); assert.strictEqual(err.is.TooManyParts, true);
assert.strictEqual(result, undefined); assert.strictEqual(result, undefined);
done(); done();
}); });
@ -351,7 +351,7 @@ describe('Multipart Upload API', () => {
}, postBody); }, postBody);
objectPutPart(authInfo, partRequest, undefined, log, objectPutPart(authInfo, partRequest, undefined, log,
(err, result) => { (err, result) => {
assert.deepStrictEqual(err, errors.InvalidArgument); assert.strictEqual(err.is.InvalidArgument, true);
assert.strictEqual(result, undefined); assert.strictEqual(result, undefined);
done(); done();
}); });
@ -394,7 +394,7 @@ describe('Multipart Upload API', () => {
}, postBody); }, postBody);
objectPutPart(authInfo, partRequest, undefined, objectPutPart(authInfo, partRequest, undefined,
log, (err, result) => { log, (err, result) => {
assert.deepStrictEqual(err, errors.EntityTooLarge); assert.strictEqual(err.is.EntityTooLarge, true);
assert.strictEqual(result, undefined); assert.strictEqual(result, undefined);
done(); done();
}); });
@ -691,7 +691,7 @@ describe('Multipart Upload API', () => {
}; };
completeMultipartUpload(authInfo, completeMultipartUpload(authInfo,
completeRequest, log, err => { completeRequest, log, err => {
assert.deepStrictEqual(err, errors.MalformedXML); assert.strictEqual(err.is.MalformedXML, true);
assert.strictEqual(metadata.keyMaps.get(mpuBucket).size, assert.strictEqual(metadata.keyMaps.get(mpuBucket).size,
2); 2);
done(); done();
@ -745,7 +745,7 @@ describe('Multipart Upload API', () => {
calculatedHash, calculatedHash,
}; };
completeMultipartUpload(authInfo, completeRequest, log, err => { completeMultipartUpload(authInfo, completeRequest, log, err => {
assert.deepStrictEqual(err, errors.MalformedXML); assert.strictEqual(err.is.MalformedXML, true);
done(); done();
}); });
}); });
@ -818,8 +818,7 @@ describe('Multipart Upload API', () => {
}; };
completeMultipartUpload(authInfo, completeMultipartUpload(authInfo,
completeRequest, log, err => { completeRequest, log, err => {
assert.deepStrictEqual(err, assert.strictEqual(err.is.InvalidPartOrder, true);
errors.InvalidPartOrder);
assert.strictEqual(metadata.keyMaps assert.strictEqual(metadata.keyMaps
.get(mpuBucket).size, 3); .get(mpuBucket).size, 3);
done(); done();
@ -876,8 +875,7 @@ describe('Multipart Upload API', () => {
calculatedHash, calculatedHash,
}; };
completeMultipartUpload(authInfo, completeRequest, log, err => { completeMultipartUpload(authInfo, completeRequest, log, err => {
assert.deepStrictEqual(err, assert.strictEqual(err.is.InvalidPart, true);
errors.InvalidPart);
assert.strictEqual(metadata.keyMaps.get(mpuBucket).size, 2); assert.strictEqual(metadata.keyMaps.get(mpuBucket).size, 2);
done(); done();
}); });
@ -950,7 +948,7 @@ describe('Multipart Upload API', () => {
assert.strictEqual(metadata.keyMaps.get(mpuBucket).size, 3); assert.strictEqual(metadata.keyMaps.get(mpuBucket).size, 3);
completeMultipartUpload(authInfo, completeMultipartUpload(authInfo,
completeRequest, log, err => { completeRequest, log, err => {
assert.deepStrictEqual(err, errors.InvalidPart); assert.strictEqual(err.is.InvalidPart, true);
done(); done();
}); });
}); });
@ -1032,8 +1030,7 @@ describe('Multipart Upload API', () => {
assert.strictEqual(metadata.keyMaps.get(mpuBucket).size, 3); assert.strictEqual(metadata.keyMaps.get(mpuBucket).size, 3);
completeMultipartUpload(authInfo, completeMultipartUpload(authInfo,
completeRequest, log, err => { completeRequest, log, err => {
assert.deepStrictEqual(err, assert.strictEqual(err.is.EntityTooSmall, true);
errors.EntityTooSmall);
done(); done();
}); });
}); });
@ -1716,7 +1713,7 @@ describe('Multipart Upload API', () => {
bucketPut(authInfo, bucketPutRequest, log, () => bucketPut(authInfo, bucketPutRequest, log, () =>
objectPutPart(authInfo, partRequest, undefined, log, err => { objectPutPart(authInfo, partRequest, undefined, log, err => {
assert.strictEqual(err, errors.NoSuchUpload); assert.strictEqual(err.is.NoSuchUpload, true);
done(); done();
}) })
); );
@ -1831,7 +1828,7 @@ describe('Multipart Upload API', () => {
completeMultipartUpload(authInfo, completeRequest, log, err => { completeMultipartUpload(authInfo, completeRequest, log, err => {
// expect a failure here because we could not // expect a failure here because we could not
// remove the overview key // remove the overview key
assert.strictEqual(err, errors.InternalError); assert.strictEqual(err.is.InternalError, true);
next(null, eTag, testUploadId); next(null, eTag, testUploadId);
}); });
}, },
@ -2054,7 +2051,7 @@ describe('complete mpu with versioning', () => {
completeMultipartUpload(authInfo, completeRequest, log, err => { completeMultipartUpload(authInfo, completeRequest, log, err => {
// expect a failure here because we could not // expect a failure here because we could not
// remove the overview key // remove the overview key
assert.strictEqual(err, errors.InternalError); assert.strictEqual(err.is.InternalError, true);
next(null, eTag, testUploadId); next(null, eTag, testUploadId);
}); });
}, },

View File

@ -109,7 +109,7 @@ describe('objectCopyPart', () => {
_createObjectCopyPartRequest(destBucketName, uploadId, headers); _createObjectCopyPartRequest(destBucketName, uploadId, headers);
objectPutCopyPart( objectPutCopyPart(
authInfo, req, sourceBucketName, objectKey, undefined, log, err => { authInfo, req, sourceBucketName, objectKey, undefined, log, err => {
assert(err.InvalidArgument); assert.strictEqual(err.is.InvalidArgument, true);
assert.strictEqual(err.description, assert.strictEqual(err.description,
'The x-amz-copy-source-range value must be of the form ' + 'The x-amz-copy-source-range value must be of the form ' +
'bytes=first-last where first and last are the ' + 'bytes=first-last where first and last are the ' +

View File

@ -93,8 +93,7 @@ describe('objectDelete API', () => {
assert.strictEqual(err, null); assert.strictEqual(err, null);
objectGet(authInfo, testGetObjectRequest, false, objectGet(authInfo, testGetObjectRequest, false,
log, err => { log, err => {
assert.deepStrictEqual(err, assert.strictEqual(err.is.NoSuchKey, true);
errors.NoSuchKey);
done(); done();
}); });
}); });

View File

@ -79,7 +79,7 @@ describe('objectGetACL API', () => {
'for a nonexistent object', done => { 'for a nonexistent object', done => {
bucketPut(authInfo, testBucketPutRequest, log, () => { bucketPut(authInfo, testBucketPutRequest, log, () => {
objectGetACL(authInfo, testGetACLRequest, log, err => { objectGetACL(authInfo, testGetACLRequest, log, err => {
assert.deepStrictEqual(err, errors.NoSuchKey); assert.strictEqual(err.is.NoSuchKey, true);
done(); done();
}); });
}); });

View File

@ -61,7 +61,7 @@ describe('getObjectLegalHold API', () => {
it('should return InvalidRequest error', done => { it('should return InvalidRequest error', done => {
objectGetLegalHold(authInfo, getObjectLegalHoldRequest, log, objectGetLegalHold(authInfo, getObjectLegalHoldRequest, log,
err => { err => {
assert.strictEqual(err.InvalidRequest, true); assert.strictEqual(err.is.InvalidRequest, true);
done(); done();
}); });
}); });

View File

@ -64,7 +64,7 @@ describe('getObjectRetention API', () => {
it('should return InvalidRequest error', done => { it('should return InvalidRequest error', done => {
objectGetRetention(authInfo, getObjRetRequest, log, err => { objectGetRetention(authInfo, getObjRetRequest, log, err => {
assert.strictEqual(err.InvalidRequest, true); assert.strictEqual(err.is.InvalidRequest, true);
done(); done();
}); });
}); });
@ -85,7 +85,7 @@ describe('getObjectRetention API', () => {
it('should return NoSuchObjectLockConfiguration if no retention set', it('should return NoSuchObjectLockConfiguration if no retention set',
done => { done => {
objectGetRetention(authInfo, getObjRetRequest, log, err => { objectGetRetention(authInfo, getObjRetRequest, log, err => {
assert.strictEqual(err.NoSuchObjectLockConfiguration, true); assert.strictEqual(err.is.NoSuchObjectLockConfiguration, true);
done(); done();
}); });
}); });

View File

@ -60,7 +60,7 @@ describe('objectHead API', () => {
(err, resHeaders) => { (err, resHeaders) => {
assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`); assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`);
objectHead(authInfo, testGetRequest, log, err => { objectHead(authInfo, testGetRequest, log, err => {
assert.deepStrictEqual(err, errors.NotModified); assert.strictEqual(err.is.NotModified, true);
done(); done();
}); });
}); });
@ -83,8 +83,7 @@ describe('objectHead API', () => {
(err, resHeaders) => { (err, resHeaders) => {
assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`); assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`);
objectHead(authInfo, testGetRequest, log, err => { objectHead(authInfo, testGetRequest, log, err => {
assert.deepStrictEqual(err, assert.strictEqual(err.is.PreconditionFailed, true);
errors.PreconditionFailed);
done(); done();
}); });
}); });
@ -107,8 +106,7 @@ describe('objectHead API', () => {
(err, resHeaders) => { (err, resHeaders) => {
assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`); assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`);
objectHead(authInfo, testGetRequest, log, err => { objectHead(authInfo, testGetRequest, log, err => {
assert.deepStrictEqual(err, assert.strictEqual(err.is.PreconditionFailed, true);
errors.PreconditionFailed);
done(); done();
}); });
}); });
@ -131,7 +129,7 @@ describe('objectHead API', () => {
(err, resHeaders) => { (err, resHeaders) => {
assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`); assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`);
objectHead(authInfo, testGetRequest, log, err => { objectHead(authInfo, testGetRequest, log, err => {
assert.deepStrictEqual(err, errors.NotModified); assert.strictEqual(err.is.NotModified, true);
done(); done();
}); });
}); });

View File

@ -112,7 +112,7 @@ describe('objectPut API', () => {
it('should return an error if the bucket does not exist', done => { it('should return an error if the bucket does not exist', done => {
objectPut(authInfo, testPutObjectRequest, undefined, log, err => { objectPut(authInfo, testPutObjectRequest, undefined, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -123,7 +123,7 @@ describe('objectPut API', () => {
log, () => { log, () => {
objectPut(authInfo, testPutObjectRequest, objectPut(authInfo, testPutObjectRequest,
undefined, log, err => { undefined, log, err => {
assert.deepStrictEqual(err, errors.AccessDenied); assert.strictEqual(err.is.AccessDenied, true);
done(); done();
}); });
}); });
@ -592,7 +592,7 @@ describe('objectPut API with versioning', () => {
bucketPut(authInfo, testPutBucketRequest, log, () => { bucketPut(authInfo, testPutBucketRequest, log, () => {
objectPut(authInfo, testPutObjectRequest, undefined, log, objectPut(authInfo, testPutObjectRequest, undefined, log,
err => { err => {
assert.deepStrictEqual(err, errors.BadDigest); assert.strictEqual(err.is.BadDigest, true);
// orphan objects don't get deleted // orphan objects don't get deleted
// until the next tick // until the next tick
// in memory // in memory

View File

@ -63,8 +63,7 @@ describe('putObjectACL API', () => {
(err, resHeaders) => { (err, resHeaders) => {
assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`); assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`);
objectPutACL(authInfo, testObjACLRequest, log, err => { objectPutACL(authInfo, testObjACLRequest, log, err => {
assert assert.strictEqual(err.is.InvalidArgument, true);
.deepStrictEqual(err, errors.InvalidArgument);
done(); done();
}); });
}); });
@ -208,8 +207,8 @@ describe('putObjectACL API', () => {
(err, resHeaders) => { (err, resHeaders) => {
assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`); assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`);
objectPutACL(authInfo, testObjACLRequest, log, err => { objectPutACL(authInfo, testObjACLRequest, log, err => {
assert.strictEqual(err, assert.strictEqual(
errors.UnresolvableGrantByEmailAddress); err.is.UnresolvableGrantByEmailAddress, true);
done(); done();
}); });
}); });
@ -274,8 +273,7 @@ describe('putObjectACL API', () => {
objectPut(authInfo, testPutObjectRequest, undefined, log, objectPut(authInfo, testPutObjectRequest, undefined, log,
() => { () => {
objectPutACL(authInfo, testObjACLRequest, log, err => { objectPutACL(authInfo, testObjACLRequest, log, err => {
assert.deepStrictEqual(err, assert.strictEqual(err.is.AccessDenied, true);
errors.AccessDenied);
done(); done();
}); });
}); });
@ -342,8 +340,8 @@ describe('putObjectACL API', () => {
(err, resHeaders) => { (err, resHeaders) => {
assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`); assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`);
objectPutACL(authInfo, testObjACLRequest, log, err => { objectPutACL(authInfo, testObjACLRequest, log, err => {
assert.strictEqual(err, assert.strictEqual(
errors.UnresolvableGrantByEmailAddress); err.is.UnresolvableGrantByEmailAddress, true);
done(); done();
}); });
}); });
@ -371,8 +369,7 @@ describe('putObjectACL API', () => {
(err, resHeaders) => { (err, resHeaders) => {
assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`); assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`);
objectPutACL(authInfo, testObjACLRequest, log, err => { objectPutACL(authInfo, testObjACLRequest, log, err => {
assert.deepStrictEqual(err, assert.strictEqual(err.is.MalformedACLError, true);
errors.MalformedACLError);
done(); done();
}); });
}); });
@ -400,7 +397,7 @@ describe('putObjectACL API', () => {
(err, resHeaders) => { (err, resHeaders) => {
assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`); assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`);
objectPutACL(authInfo, testObjACLRequest, log, err => { objectPutACL(authInfo, testObjACLRequest, log, err => {
assert.deepStrictEqual(err, errors.MalformedXML); assert.strictEqual(err.is.MalformedXML, true);
done(); done();
}); });
}); });
@ -427,7 +424,7 @@ describe('putObjectACL API', () => {
(err, resHeaders) => { (err, resHeaders) => {
assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`); assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`);
objectPutACL(authInfo, testObjACLRequest, log, err => { objectPutACL(authInfo, testObjACLRequest, log, err => {
assert.deepStrictEqual(err, errors.InvalidArgument); assert.strictEqual(err.is.InvalidArgument, true);
done(); done();
}); });
}); });
@ -455,7 +452,7 @@ describe('putObjectACL API', () => {
(err, resHeaders) => { (err, resHeaders) => {
assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`); assert.strictEqual(resHeaders.ETag, `"${correctMD5}"`);
objectPutACL(authInfo, testObjACLRequest, log, err => { objectPutACL(authInfo, testObjACLRequest, log, err => {
assert.deepStrictEqual(err, errors.InvalidArgument); assert.strictEqual(err.is.InvalidArgument, true);
done(); done();
}); });
}); });

View File

@ -55,7 +55,7 @@ describe('putObjectLegalHold API', () => {
it('should return InvalidRequest error', done => { it('should return InvalidRequest error', done => {
objectPutLegalHold(authInfo, putLegalHoldReq('ON'), log, err => { objectPutLegalHold(authInfo, putLegalHoldReq('ON'), log, err => {
assert.strictEqual(err.InvalidRequest, true); assert.strictEqual(err.is.InvalidRequest, true);
done(); done();
}); });
}); });

View File

@ -99,7 +99,7 @@ describe('putObjectRetention API', () => {
it('should return InvalidRequest error', done => { it('should return InvalidRequest error', done => {
objectPutRetention(authInfo, putObjRetRequestGovernance, log, err => { objectPutRetention(authInfo, putObjRetRequestGovernance, log, err => {
assert.strictEqual(err.InvalidRequest, true); assert.strictEqual(err.is.InvalidRequest, true);
done(); done();
}); });
}); });
@ -134,7 +134,7 @@ describe('putObjectRetention API', () => {
objectPutRetention(authInfo, putObjRetRequestCompliance, log, err => { objectPutRetention(authInfo, putObjRetRequestCompliance, log, err => {
assert.ifError(err); assert.ifError(err);
return objectPutRetention(authInfo, putObjRetRequestGovernance, log, err => { return objectPutRetention(authInfo, putObjRetRequestGovernance, log, err => {
assert.deepStrictEqual(err, errors.AccessDenied); assert.strictEqual(err.is.AccessDenied, true);
done(); done();
}); });
}); });
@ -144,7 +144,7 @@ describe('putObjectRetention API', () => {
objectPutRetention(authInfo, putObjRetRequestCompliance, log, err => { objectPutRetention(authInfo, putObjRetRequestCompliance, log, err => {
assert.ifError(err); assert.ifError(err);
return objectPutRetention(authInfo, putObjRetRequestComplianceShorter, log, err => { return objectPutRetention(authInfo, putObjRetRequestComplianceShorter, log, err => {
assert.deepStrictEqual(err, errors.AccessDenied); assert.strictEqual(err.is.AccessDenied, true);
done(); done();
}); });
}); });
@ -155,7 +155,7 @@ describe('putObjectRetention API', () => {
objectPutRetention(authInfo, putObjRetRequestGovernance, log, err => { objectPutRetention(authInfo, putObjRetRequestGovernance, log, err => {
assert.ifError(err); assert.ifError(err);
return objectPutRetention(authInfo, putObjRetRequestGovernance, log, err => { return objectPutRetention(authInfo, putObjRetRequestGovernance, log, err => {
assert.deepStrictEqual(err, errors.AccessDenied); assert.strictEqual(err.is.AccessDenied, true);
done(); done();
}); });
}); });

View File

@ -79,7 +79,7 @@ describe('serviceGet API', () => {
it('should prevent anonymous user from accessing getService API', done => { it('should prevent anonymous user from accessing getService API', done => {
const publicAuthInfo = makeAuthInfo(constants.publicId); const publicAuthInfo = makeAuthInfo(constants.publicId);
serviceGet(publicAuthInfo, serviceGetRequest, log, err => { serviceGet(publicAuthInfo, serviceGetRequest, log, err => {
assert.deepStrictEqual(err, errors.AccessDenied); assert.strictEqual(err.is.AccessDenied, true);
done(); done();
}); });
}); });

View File

@ -101,7 +101,7 @@ describe('transient bucket handling', () => {
it('putBucket request should return error if ' + it('putBucket request should return error if ' +
'transient bucket created by different account', done => { 'transient bucket created by different account', done => {
bucketPut(otherAccountAuthInfo, baseTestRequest, log, err => { bucketPut(otherAccountAuthInfo, baseTestRequest, log, err => {
assert.deepStrictEqual(err, errors.BucketAlreadyExists); assert.strictEqual(err.is.BucketAlreadyExists, true);
serviceGet(otherAccountAuthInfo, serviceGetRequest, serviceGet(otherAccountAuthInfo, serviceGetRequest,
log, (err, data) => { log, (err, data) => {
parseString(data, (err, result) => { parseString(data, (err, result) => {
@ -237,7 +237,7 @@ describe('transient bucket handling', () => {
bucketDelete(authInfo, baseTestRequest, log, err => { bucketDelete(authInfo, baseTestRequest, log, err => {
assert.ifError(err); assert.ifError(err);
metadata.getBucket(bucketName, log, err => { metadata.getBucket(bucketName, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -247,7 +247,7 @@ describe('transient bucket handling', () => {
'request is not from owner', done => { 'request is not from owner', done => {
bucketDelete(otherAccountAuthInfo, baseTestRequest, bucketDelete(otherAccountAuthInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.AccessDenied); assert.strictEqual(err.is.AccessDenied, true);
done(); done();
}); });
}); });
@ -260,7 +260,7 @@ describe('transient bucket handling', () => {
bucketGetRequest.query = {}; bucketGetRequest.query = {};
bucketGet(authInfo, bucketGetRequest, bucketGet(authInfo, bucketGetRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -273,7 +273,7 @@ describe('transient bucket handling', () => {
bucketGetACLRequest.query = { acl: '' }; bucketGetACLRequest.query = { acl: '' };
bucketGetACL(authInfo, bucketGetACLRequest, bucketGetACL(authInfo, bucketGetACLRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -281,7 +281,7 @@ describe('transient bucket handling', () => {
it('bucketGetCors request on transient bucket should return ' + it('bucketGetCors request on transient bucket should return ' +
'NoSuchBucket error', done => { 'NoSuchBucket error', done => {
bucketGetCors(authInfo, baseTestRequest, log, err => { bucketGetCors(authInfo, baseTestRequest, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -297,7 +297,7 @@ describe('transient bucket handling', () => {
bucketPutCorsRequest.headers['content-md5'] = crypto.createHash('md5') bucketPutCorsRequest.headers['content-md5'] = crypto.createHash('md5')
.update(bucketPutCorsRequest.post, 'utf8').digest('base64'); .update(bucketPutCorsRequest.post, 'utf8').digest('base64');
bucketPutCors(authInfo, bucketPutCorsRequest, log, err => { bucketPutCors(authInfo, bucketPutCorsRequest, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -305,7 +305,7 @@ describe('transient bucket handling', () => {
it('bucketDeleteCors request on transient bucket should return ' + it('bucketDeleteCors request on transient bucket should return ' +
'NoSuchBucket error', done => { 'NoSuchBucket error', done => {
bucketDeleteCors(authInfo, baseTestRequest, log, err => { bucketDeleteCors(authInfo, baseTestRequest, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -313,7 +313,7 @@ describe('transient bucket handling', () => {
it('bucketGetWebsite request on transient bucket should return ' + it('bucketGetWebsite request on transient bucket should return ' +
'NoSuchBucket error', done => { 'NoSuchBucket error', done => {
bucketGetWebsite(authInfo, baseTestRequest, log, err => { bucketGetWebsite(authInfo, baseTestRequest, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -326,7 +326,7 @@ describe('transient bucket handling', () => {
'<IndexDocument><Suffix>index.html</Suffix></IndexDocument>' + '<IndexDocument><Suffix>index.html</Suffix></IndexDocument>' +
'</WebsiteConfiguration>'; '</WebsiteConfiguration>';
bucketPutWebsite(authInfo, bucketPutWebsiteRequest, log, err => { bucketPutWebsite(authInfo, bucketPutWebsiteRequest, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -334,7 +334,7 @@ describe('transient bucket handling', () => {
it('bucketDeleteWebsite request on transient bucket should return ' + it('bucketDeleteWebsite request on transient bucket should return ' +
'NoSuchBucket error', done => { 'NoSuchBucket error', done => {
bucketDeleteWebsite(authInfo, baseTestRequest, log, err => { bucketDeleteWebsite(authInfo, baseTestRequest, log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -343,7 +343,7 @@ describe('transient bucket handling', () => {
'error', done => { 'error', done => {
bucketHead(authInfo, baseTestRequest, bucketHead(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -357,7 +357,7 @@ describe('transient bucket handling', () => {
completeMpuRequest.query = { uploadId }; completeMpuRequest.query = { uploadId };
completeMultipartUpload(authInfo, completeMpuRequest, completeMultipartUpload(authInfo, completeMpuRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchUpload); assert.strictEqual(err.is.NoSuchUpload, true);
done(); done();
}); });
}); });
@ -371,7 +371,7 @@ describe('transient bucket handling', () => {
listRequest.query = { uploadId }; listRequest.query = { uploadId };
listParts(authInfo, listRequest, listParts(authInfo, listRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchUpload); assert.strictEqual(err.is.NoSuchUpload, true);
done(); done();
}); });
}); });
@ -396,7 +396,7 @@ describe('transient bucket handling', () => {
config.locationConstraints[locationConstraint]. config.locationConstraints[locationConstraint].
legacyAwsBehavior = true; legacyAwsBehavior = true;
multipartDelete(authInfo, deleteRequest, log, err => { multipartDelete(authInfo, deleteRequest, log, err => {
assert.deepStrictEqual(err, errors.NoSuchUpload); assert.strictEqual(err.is.NoSuchUpload, true);
done(); done();
}); });
}); });
@ -423,7 +423,7 @@ describe('transient bucket handling', () => {
partNumber: '1' }; partNumber: '1' };
objectPutPart(authInfo, putPartRequest, undefined, objectPutPart(authInfo, putPartRequest, undefined,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchUpload); assert.strictEqual(err.is.NoSuchUpload, true);
done(); done();
}); });
}); });
@ -435,7 +435,7 @@ describe('transient bucket handling', () => {
listRequest.query = {}; listRequest.query = {};
listMultipartUploads(authInfo, listRequest, listMultipartUploads(authInfo, listRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -445,7 +445,7 @@ describe('transient bucket handling', () => {
done => { done => {
objectGet(authInfo, baseTestRequest, false, objectGet(authInfo, baseTestRequest, false,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -454,7 +454,7 @@ describe('transient bucket handling', () => {
'NoSuchBucket error', done => { 'NoSuchBucket error', done => {
objectGetACL(authInfo, baseTestRequest, objectGetACL(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -463,7 +463,7 @@ describe('transient bucket handling', () => {
'NoSuchBucket error', done => { 'NoSuchBucket error', done => {
objectHead(authInfo, baseTestRequest, objectHead(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -472,7 +472,7 @@ describe('transient bucket handling', () => {
'NoSuchBucket error', done => { 'NoSuchBucket error', done => {
objectPutACL(authInfo, baseTestRequest, objectPutACL(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });
@ -481,7 +481,7 @@ describe('transient bucket handling', () => {
'NoSuchBucket error', done => { 'NoSuchBucket error', done => {
objectDelete(authInfo, baseTestRequest, objectDelete(authInfo, baseTestRequest,
log, err => { log, err => {
assert.deepStrictEqual(err, errors.NoSuchBucket); assert.strictEqual(err.is.NoSuchBucket, true);
done(); done();
}); });
}); });

View File

@ -45,7 +45,7 @@ describe('bucket creation', () => {
it('should return 409 if try to recreate in non-us-east-1', done => { it('should return 409 if try to recreate in non-us-east-1', done => {
createBucket(authInfo, bucketName, headers, createBucket(authInfo, bucketName, headers,
normalBehaviorLocationConstraint, log, err => { normalBehaviorLocationConstraint, log, err => {
assert.strictEqual(err, errors.BucketAlreadyOwnedByYou); assert.strictEqual(err.is.BucketAlreadyOwnedByYou, true);
done(); done();
}); });
}); });
@ -64,7 +64,7 @@ describe('bucket creation', () => {
it('should return 409 if try to recreate in us-east-1', done => { it('should return 409 if try to recreate in us-east-1', done => {
createBucket(authInfo, bucketName, headers, createBucket(authInfo, bucketName, headers,
specialBehaviorLocationConstraint, log, err => { specialBehaviorLocationConstraint, log, err => {
assert.strictEqual(err, errors.BucketAlreadyOwnedByYou); assert.strictEqual(err.is.BucketAlreadyOwnedByYou, true);
done(); done();
}); });
}); });

View File

@ -39,7 +39,7 @@ describe('bucket API for getting, putting and deleting ' +
it('should return an error in response ' + it('should return an error in response ' +
'to getObjectMD when no such key', done => { 'to getObjectMD when no such key', done => {
metadata.getObjectMD(bucketName, 'notThere', {}, log, (err, value) => { metadata.getObjectMD(bucketName, 'notThere', {}, log, (err, value) => {
assert.deepStrictEqual(err, errors.NoSuchKey); assert.strictEqual(err.is.NoSuchKey, true);
assert.strictEqual(value, undefined); assert.strictEqual(value, undefined);
done(); done();
}); });
@ -52,7 +52,7 @@ describe('bucket API for getting, putting and deleting ' +
() => { () => {
metadata.getObjectMD(bucketName, 'objectToDelete', {}, log, metadata.getObjectMD(bucketName, 'objectToDelete', {}, log,
(err, value) => { (err, value) => {
assert.deepStrictEqual(err, errors.NoSuchKey); assert.strictEqual(err.is.NoSuchKey, true);
assert.strictEqual(value, undefined); assert.strictEqual(value, undefined);
done(); done();
}); });