@@ -162,8 +162,10 @@ function size_gt_lt_lifecycle_configuration(Bucket, gt, lt) {
162
162
Date : midnight ,
163
163
} ,
164
164
Filter : {
165
- ObjectSizeLessThan : lt ,
166
- ObjectSizeGreaterThan : gt
165
+ And : {
166
+ ObjectSizeLessThan : lt ,
167
+ ObjectSizeGreaterThan : gt ,
168
+ } ,
167
169
} ,
168
170
Status : 'Enabled' ,
169
171
} , ] ,
@@ -368,7 +370,7 @@ function duplicate_id_lifecycle_configuration(Bucket, Key) {
368
370
Bucket,
369
371
LifecycleConfiguration : {
370
372
Rules : [ {
371
- ID1 ,
373
+ ID : ID1 ,
372
374
Expiration : {
373
375
Days : 17 ,
374
376
} ,
@@ -378,7 +380,7 @@ function duplicate_id_lifecycle_configuration(Bucket, Key) {
378
380
Status : 'Enabled' ,
379
381
} ,
380
382
{
381
- ID2 ,
383
+ ID : ID2 ,
382
384
Expiration : {
383
385
Days : 18 ,
384
386
} ,
@@ -622,7 +624,7 @@ exports.test_rule_id_length = async function(Bucket, Key, s3) {
622
624
await s3 . putBucketLifecycleConfiguration ( putLifecycleParams ) ;
623
625
assert . fail ( `Expected error for ID length exceeding maximum allowed characters ${ s3_const . MAX_RULE_ID_LENGTH } , but request was successful` ) ;
624
626
} catch ( error ) {
625
- assert ( error . code === 'InvalidArgument' , `Expected InvalidArgument: id length exceeding ${ s3_const . MAX_RULE_ID_LENGTH } characters` ) ;
627
+ assert ( error . Code === 'InvalidArgument' , `Expected InvalidArgument: id length exceeding ${ s3_const . MAX_RULE_ID_LENGTH } characters` ) ;
626
628
}
627
629
} ;
628
630
@@ -633,7 +635,8 @@ exports.test_rule_duplicate_id = async function(Bucket, Key, s3) {
633
635
await s3 . putBucketLifecycleConfiguration ( putLifecycleParams ) ;
634
636
assert . fail ( 'Expected error for duplicate rule ID, but request was successful' ) ;
635
637
} catch ( error ) {
636
- assert ( error . code === 'InvalidArgument' , 'Expected InvalidArgument: duplicate ID found in the rules' ) ;
638
+ console . log ( "Received error: " , error ) ;
639
+ assert ( error . Code === 'InvalidArgument' , 'Expected InvalidArgument: duplicate ID found in the rules' ) ;
637
640
}
638
641
} ;
639
642
@@ -647,49 +650,49 @@ exports.test_rule_status_value = async function(Bucket, Key, s3) {
647
650
await s3 . putBucketLifecycleConfiguration ( putLifecycleParams ) ;
648
651
assert . fail ( 'Expected MalformedXML error due to wrong status value, but received a different response' ) ;
649
652
} catch ( error ) {
650
- assert ( error . code === 'MalformedXML' , `Expected MalformedXML error: due to invalid status value` ) ;
653
+ assert ( error . Code === 'MalformedXML' , `Expected MalformedXML error: due to invalid status value` ) ;
651
654
}
652
655
} ;
653
656
654
657
exports . test_invalid_filter_format = async function ( Bucket , Key , s3 ) {
655
- const putLifecycleParams = id_lifecycle_configuration ( Bucket , Key ) ;
658
+ const putLifecycleParams = tags_lifecycle_configuration ( Bucket , Key ) ;
656
659
657
660
// append prefix for invalid filter: "And" condition is missing, but multiple filters are present
658
- putLifecycleParams . LifecycleConfiguration . Rules [ 0 ] . Filter [ 0 ] . Prefix = 'test-prefix' ;
661
+ putLifecycleParams . LifecycleConfiguration . Rules [ 0 ] . Filter . Prefix = 'test-prefix' ;
659
662
660
663
try {
661
664
await s3 . putBucketLifecycleConfiguration ( putLifecycleParams ) ;
662
665
assert . fail ( 'Expected MalformedXML error due to missing "And" condition for multiple filters' ) ;
663
666
} catch ( error ) {
664
- assert ( error . code === 'MalformedXML' , 'Expected MalformedXML error: due to missing "And" condition' ) ;
667
+ assert ( error . Code === 'MalformedXML' , 'Expected MalformedXML error: due to missing "And" condition' ) ;
665
668
}
666
669
} ;
667
670
668
671
exports . test_invalid_expiration_date_format = async function ( Bucket , Key , s3 ) {
669
672
const putLifecycleParams = date_lifecycle_configuration ( Bucket , Key ) ;
670
673
671
674
// set expiration with a Date that is not at midnight UTC (incorrect time specified)
672
- putLifecycleParams . LifecycleConfiguration . Rules [ 0 ] . Expiration [ 0 ] . Date = '2025-01-01T15:30:00Z' ;
675
+ putLifecycleParams . LifecycleConfiguration . Rules [ 0 ] . Expiration . Date = new Date ( '2025-01-01T15:30:00Z' ) ;
673
676
674
677
try {
675
678
await s3 . putBucketLifecycleConfiguration ( putLifecycleParams ) ;
676
679
assert . fail ( 'Expected error due to incorrect date format (not at midnight UTC), but request was successful' ) ;
677
680
} catch ( error ) {
678
- assert ( error . code === 'InvalidArgument' , 'Expected InvalidArgument error: date must be at midnight UTC' ) ;
681
+ assert ( error . Code === 'InvalidArgument' , 'Expected InvalidArgument error: date must be at midnight UTC' ) ;
679
682
}
680
683
} ;
681
684
682
685
exports . test_expiration_multiple_fields = async function ( Bucket , Key , s3 ) {
683
686
const putLifecycleParams = days_lifecycle_configuration ( Bucket , Key ) ;
684
687
685
688
// append ExpiredObjectDeleteMarker for invalid expiration with multiple fields
686
- putLifecycleParams . LifecycleConfiguration . Rules [ 0 ] . Expiration [ 0 ] . ExpiredObjectDeleteMarker = false ;
689
+ putLifecycleParams . LifecycleConfiguration . Rules [ 0 ] . Expiration . ExpiredObjectDeleteMarker = false ;
687
690
688
691
try {
689
692
await s3 . putBucketLifecycleConfiguration ( putLifecycleParams ) ;
690
693
assert . fail ( 'Expected MalformedXML error due to multiple expiration fields' ) ;
691
694
} catch ( error ) {
692
- assert ( error . code === 'MalformedXML' , 'Expected MalformedXML error: due to multiple expiration fields' ) ;
695
+ assert ( error . Code === 'MalformedXML' , 'Expected MalformedXML error: due to multiple expiration fields' ) ;
693
696
}
694
697
} ;
695
698
@@ -705,7 +708,7 @@ exports.test_abortincompletemultipartupload_with_tags = async function(Bucket, K
705
708
await s3 . putBucketLifecycleConfiguration ( putLifecycleParams ) ;
706
709
assert . fail ( 'Expected InvalidArgument error due to AbortIncompleteMultipartUpload specified with tags' ) ;
707
710
} catch ( error ) {
708
- assert ( error . code === 'InvalidArgument' , 'Expected InvalidArgument: AbortIncompleteMultipartUpload cannot be specified with tags' ) ;
711
+ assert ( error . Code === 'InvalidArgument' , 'Expected InvalidArgument: AbortIncompleteMultipartUpload cannot be specified with tags' ) ;
709
712
}
710
713
} ;
711
714
@@ -721,6 +724,6 @@ exports.test_abortincompletemultipartupload_with_sizes = async function(Bucket,
721
724
await s3 . putBucketLifecycleConfiguration ( putLifecycleParams ) ;
722
725
assert . fail ( 'Expected InvalidArgument error due to AbortIncompleteMultipartUpload specified with object size' ) ;
723
726
} catch ( error ) {
724
- assert ( error . code === 'InvalidArgument' , 'Expected InvalidArgument: AbortIncompleteMultipartUpload cannot be specified with object size' ) ;
727
+ assert ( error . Code === 'InvalidArgument' , 'Expected InvalidArgument: AbortIncompleteMultipartUpload cannot be specified with object size' ) ;
725
728
}
726
729
} ;
0 commit comments