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

View File

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

View File

@ -11,16 +11,16 @@ function deleteUserBucketEntry(bucketName, canonicalID, log, cb) {
metadata.deleteObjectMD(usersBucket, keyForUserBucket, {}, log, error => {
// If the object representing the bucket is not in the
// users bucket just continue
if (error && error.NoSuchKey) {
if (error && error.is.NoSuchKey) {
return cb(null);
// BACKWARDS COMPATIBILITY: Remove this once no longer
// have old user bucket format
} else if (error && error.NoSuchBucket) {
} else if (error && error.is.NoSuchBucket) {
const keyForUserBucket2 = createKeyForUserBucket(canonicalID,
oldSplitter, bucketName);
return metadata.deleteObjectMD(oldUsersBucket, keyForUserBucket2,
{}, log, error => {
if (error && !error.NoSuchKey) {
if (error && !error.is.NoSuchKey) {
log.error('from metadata while deleting user bucket',
{ 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
// delete the null version, so proceed with putting a
// new version
if (err === errors.NoSuchKey) {
if (err === errors.is.NoSuchKey) {
return next(null, options);
}
return next(errors.InternalError);

View File

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

View File

@ -210,10 +210,10 @@ function getObjMetadataAndDelete(authInfo, canonicalID, request,
(versionId, callback) => metadataGetObject(bucketName, entry.key,
versionId, log, (err, objMD) => {
// if general error from metadata return error
if (err && !err.NoSuchKey) {
if (err && !err.is.NoSuchKey) {
return callback(err);
}
if (err && err.NoSuchKey) {
if (err && err.is.NoSuchKey) {
const verCfg = bucket.getVersioningConfiguration();
// To adhere to AWS behavior, create a delete marker
// 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(),
log, (err, authorizationResults) => {
// there were no policies so received a blanket AccessDenied
if (err && err.AccessDenied) {
if (err && err.is.AccessDenied) {
objects.forEach(entry => {
errorResults.push({
entry,
error: errors.AccessDenied });
error: errors.is.AccessDenied });
});
// send empty array for inPlay
return next(null, quietSetting, errorResults, []);

View File

@ -29,10 +29,10 @@ function multipartDelete(authInfo, request, log, callback) {
request.method, destinationBucket);
const location = destinationBucket ?
destinationBucket.getLocationConstraint() : null;
if (err && err !== errors.NoSuchUpload) {
if (err && !err.is.NoSuchUpload) {
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', {
method: 'multipartDelete',
uploadId,

View File

@ -182,7 +182,7 @@ function objectPutCopyPart(authInfo, request, sourceBucket,
sourceLocationConstraintName, next) {
return metadata.getBucket(mpuBucketName, log,
(err, mpuBucket) => {
if (err && err.NoSuchBucket) {
if (err && err.is.NoSuchBucket) {
return next(errors.NoSuchUpload);
}
if (err) {
@ -211,7 +211,7 @@ function objectPutCopyPart(authInfo, request, sourceBucket,
return metadata.getObjectMD(mpuBucketName, mpuOverviewKey,
null, log, (err, res) => {
if (err) {
if (err.NoSuchKey) {
if (err.is.NoSuchKey) {
return next(errors.NoSuchUpload);
}
log.error('error getting overview object from ' +
@ -263,7 +263,7 @@ function objectPutCopyPart(authInfo, request, sourceBucket,
metadata.getObjectMD(mpuBucketName, partKey, {}, log,
(err, result) => {
// 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)',
{ error: err });
return next(err);

View File

@ -94,7 +94,7 @@ function objectPutPart(authInfo, request, streamingV4Params, log,
// Get the destination bucket.
next => metadata.getBucket(bucketName, log,
(err, destinationBucket) => {
if (err && err.NoSuchBucket) {
if (err && err.is.NoSuchBucket) {
return next(errors.NoSuchBucket, destinationBucket);
}
if (err) {
@ -142,7 +142,7 @@ function objectPutPart(authInfo, request, streamingV4Params, log,
(destinationBucket, cipherBundle, next) =>
metadata.getBucket(mpuBucketName, log,
(err, mpuBucket) => {
if (err && err.NoSuchBucket) {
if (err && err.is.NoSuchBucket) {
return next(errors.NoSuchUpload, destinationBucket);
}
if (err) {
@ -252,7 +252,7 @@ function objectPutPart(authInfo, request, streamingV4Params, log,
return metadata.getObjectMD(mpuBucketName, partKey, {}, log,
(err, res) => {
// 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)', {
error: err,
method: 'objectPutPart::metadata.getObjectMD',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@
"homepage": "https://github.com/scality/S3#readme",
"dependencies": {
"@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",
"aws-sdk": "2.905.0",
"azure-storage": "^2.1.0",

View File

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

View File

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

View File

@ -71,7 +71,7 @@ describe('Healthcheck response', () => {
const azureLocationNonExistContainerError =
results[azureLocationNonExistContainer].error;
if (err) {
assert.strictEqual(err, errors.InternalError,
assert(err.is.InternalError,
`got unexpected err in clientCheck: ${err}`);
assert(azureLocationNonExistContainerError.startsWith(
'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 delParams = getDeleteParams(fakeKey, fakeUploadId);
multipartDelete(authInfo, delParams, log, err => {
assert.equal(err, errors.NoSuchUpload,
assert(err.is.NoSuchUpload,
`Error aborting MPU: ${err}`);
done();
});
@ -639,7 +639,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
const compParams = getCompleteParams(objectKey, uploadId);
compParams.post = errorBody;
completeMultipartUpload(authInfo, compParams, log, err => {
assert.deepStrictEqual(err, errors.InvalidPart);
assert(err.is.InvalidPart);
done();
});
});
@ -661,7 +661,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
const compParams = getCompleteParams(objectKey, uploadId);
compParams.post = errorBody;
completeMultipartUpload(authInfo, compParams, log, err => {
assert.deepStrictEqual(err, errors.InvalidPartOrder);
assert(err.is.InvalidPartOrder);
done();
});
});
@ -687,7 +687,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
const compParams = getCompleteParams(objectKey, uploadId);
compParams.post = errorBody;
completeMultipartUpload(authInfo, compParams, log, err => {
assert.deepStrictEqual(err, errors.EntityTooSmall);
assert(err.is.EntityTooSmall);
done();
});
});
@ -825,7 +825,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
(uploadId, next) => {
const listParams = getListParams(objectKey, uploadId);
listParts(authInfo, listParams, log, err => {
assert(err.NoSuchUpload);
assert(err.is.NoSuchUpload);
next();
});
},

View File

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

View File

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

View File

@ -37,7 +37,8 @@ describe('objectLockHelpers: validateHeaders', () => {
= validateHeaders(objLockDisabledBucketInfo, headers, log);
const expectedError = errors.InvalidRequest.customizeDescription(
'Bucket is missing ObjectLockConfiguration');
assert.strictEqual(objectLockValidationError.InvalidRequest, true);
assert.strictEqual(
objectLockValidationError.is.InvalidRequest, true);
assert.strictEqual(objectLockValidationError.description,
expectedError.description);
});
@ -90,7 +91,8 @@ describe('objectLockHelpers: validateHeaders', () => {
const expectedError = errors.InvalidArgument.customizeDescription(
'x-amz-object-lock-retain-until-date and x-amz-object-lock-mode ' +
'must both be supplied');
assert.strictEqual(objectLockValidationError.InvalidArgument, true);
assert.strictEqual(
objectLockValidationError.is.InvalidArgument, true);
assert.strictEqual(objectLockValidationError.description,
expectedError.description);
});
@ -104,7 +106,8 @@ describe('objectLockHelpers: validateHeaders', () => {
const expectedError = errors.InvalidArgument.customizeDescription(
'x-amz-object-lock-retain-until-date and x-amz-object-lock-mode ' +
'must both be supplied');
assert.strictEqual(objectLockValidationError.InvalidArgument, true);
assert.strictEqual(
objectLockValidationError.is.InvalidArgument, true);
assert.strictEqual(objectLockValidationError.description,
expectedError.description);
});
@ -118,7 +121,8 @@ describe('objectLockHelpers: validateHeaders', () => {
'The retain until date must be in the future!');
const objectLockValidationError
= validateHeaders(bucketInfo, headers, log);
assert.strictEqual(objectLockValidationError.InvalidArgument, true);
assert.strictEqual(
objectLockValidationError.is.InvalidArgument, true);
assert.strictEqual(objectLockValidationError.description,
expectedError.description);
});
@ -131,7 +135,8 @@ describe('objectLockHelpers: validateHeaders', () => {
= validateHeaders(bucketInfo, headers, log);
const expectedError = errors.InvalidArgument.customizeDescription(
'Legal hold status must be one of "ON", "OFF"');
assert.strictEqual(objectLockValidationError.InvalidArgument, true);
assert.strictEqual(
objectLockValidationError.is.InvalidArgument, true);
assert.strictEqual(objectLockValidationError.description,
expectedError.description);
});
@ -145,7 +150,8 @@ describe('objectLockHelpers: validateHeaders', () => {
= validateHeaders(bucketInfo, headers, log);
const expectedError = errors.InvalidArgument.customizeDescription(
'Unknown wormMode directive');
assert.strictEqual(objectLockValidationError.InvalidArgument, true);
assert.strictEqual(
objectLockValidationError.is.InvalidArgument, true);
assert.strictEqual(objectLockValidationError.description,
expectedError.description);
});
@ -207,7 +213,7 @@ describe('objectLockHelpers: validateObjectLockUpdate', () => {
};
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', () => {
@ -222,7 +228,7 @@ describe('objectLockHelpers: validateObjectLockUpdate', () => {
};
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', () => {
@ -267,7 +273,7 @@ describe('objectLockHelpers: validateObjectLockUpdate', () => {
};
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', () => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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