Skip to content

Commit

Permalink
Added a test for checking handling of InternalError for invalid values
Browse files Browse the repository at this point in the history
Signed-off-by: Aayush Chouhan <[email protected]>
  • Loading branch information
achouhan09 committed Jan 8, 2025
1 parent 7435574 commit 6f01f0a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/test/lifecycle/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,3 +569,17 @@ exports.test_rule_duplicate_id = async function(Bucket, Key, s3) {
assert(error.code === 'InvalidArgument', 'Expected InvalidArgument: duplicate ID found in the rules');
}
};

exports.test_rule_status_value = async function(Bucket, Key, s3) {
const putLifecycleParams = id_lifecycle_configuration(Bucket, Key);

// set the status value to an invalid value - other then 'Enabled' and 'Disabled'
putLifecycleParams.LifecycleConfiguration.Rules[0].Status = 'enabled';

try {
await s3.putBucketLifecycleConfiguration(putLifecycleParams);
assert.fail('Expected MalformedXML error due to wrong status value, but received a different response');
} catch (error) {
assert(error.code === 'MalformedXML', `Expected MalformedXML error: due to invalid status value`);
}
};
1 change: 1 addition & 0 deletions src/test/system_tests/test_lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ async function main() {
await commonTests.test_and_prefix_size(Bucket, Key, s3);
await commonTests.test_rule_id_length(Bucket, Key, s3);
await commonTests.test_rule_duplicate_id(Bucket, Key, s3);
await commonTests.test_rule_status_value(Bucket, Key, s3);

const getObjectParams = {
Bucket,
Expand Down

0 comments on commit 6f01f0a

Please sign in to comment.