diff --git a/src/test/lifecycle/common.js b/src/test/lifecycle/common.js index acc8a971ad..bc68735c2a 100644 --- a/src/test/lifecycle/common.js +++ b/src/test/lifecycle/common.js @@ -358,6 +358,25 @@ function id_lifecycle_configuration(Bucket, Key) { }; } +function id_length_lifecycle_configuration(Bucket, Key) { + const ID = 'A'.repeat(260); // ID contains more then 255 characters + return { + Bucket, + LifecycleConfiguration: { + Rules: [{ + ID, + Expiration: { + Days: 17, + }, + Filter: { + Prefix: Key, + }, + Status: 'Enabled', + }, ], + }, + }; +} + async function put_get_lifecycle_configuration(Bucket, putLifecycleParams, s3) { const putLifecycleResult = await s3.putBucketLifecycleConfiguration(putLifecycleParams); console.log('put lifecycle params:', putLifecycleParams, 'result', putLifecycleResult); @@ -512,3 +531,13 @@ exports.test_and_prefix_size = async function(Bucket, Key, s3) { assert(actualFilter.ObjectSizeGreaterThan === expectedFilter.ObjectSizeGreaterThan, 'and prefix size filter - ObjectSizeGreaterThan'); assert(actualFilter.ObjectSizeLessThan === expectedFilter.ObjectSizeLessThan, 'and prefix size filter - ObjectSizeLessThan'); }; + +exports.test_rule_id_length = async function(Bucket, Key, s3) { + const putLifecycleParams = id_length_lifecycle_configuration(Bucket, Key); + + await s3.putBucketLifecycleConfiguration(putLifecycleParams) + .catch(error => { + assert(error.code === 'InvalidArgument', 'Expected InvalidArgument: id length exceeding 255 characters'); + console.log('Expected error received, id length exceeding 255 characters'); + }); +}; diff --git a/src/test/system_tests/test_lifecycle.js b/src/test/system_tests/test_lifecycle.js index e30acde165..ea00ee0d69 100644 --- a/src/test/system_tests/test_lifecycle.js +++ b/src/test/system_tests/test_lifecycle.js @@ -54,6 +54,7 @@ async function main() { await commonTests.test_rule_id(Bucket, Key, s3); await commonTests.test_filter_size(Bucket, s3); await commonTests.test_and_prefix_size(Bucket, Key, s3); + await commonTests.test_rule_id_length(Bucket, Key, s3); const getObjectParams = { Bucket,