@@ -829,11 +829,15 @@ mocha.describe('lifecycle', () => {
829
829
} ;
830
830
831
831
function generate_rule ( id , prefix , tags , size_gt , size_lt , expiration_days ) {
832
- const filter = { } ;
833
- if ( prefix ) filter . Prefix = prefix ;
834
- if ( tags . length ) filter . Tags = tags ;
835
- if ( size_gt !== undefined ) filter . ObjectSizeGreaterThan = size_gt ;
836
- if ( size_lt !== undefined ) filter . ObjectSizeLessThan = size_lt ;
832
+ const filters = { } ;
833
+ if ( prefix ) filters . Prefix = prefix ;
834
+ if ( Array . isArray ( tags ) && tags . length ) filters . Tags = tags ;
835
+ if ( size_gt !== undefined ) filters . ObjectSizeGreaterThan = size_gt ;
836
+ if ( size_lt !== undefined ) filters . ObjectSizeLessThan = size_lt ;
837
+
838
+ const filter = Object . keys ( filters ) . length > 1
839
+ ? { And : filters }
840
+ : filters ;
837
841
838
842
return {
839
843
ID : id ,
@@ -849,11 +853,11 @@ mocha.describe('lifecycle', () => {
849
853
console . log ( "match: " , match ) ;
850
854
851
855
const [ , expiry_str , rule_id ] = match ;
852
- const expiration_date = new Date ( expiry_str ) ;
856
+ const expiration = new Date ( expiry_str ) ;
853
857
const start = new Date ( start_time ) ;
854
- start_time . setUTCHours ( 0 , 0 , 0 , 0 ) ; // adjusting to midnight UTC otherwise the tests will fail - similar to ceph-s3 tests
858
+ start . setUTCHours ( 0 , 0 , 0 , 0 ) ; // adjusting to midnight UTC otherwise the tests will fail - fix for ceph-s3 tests
855
859
856
- const days_diff = Math . floor ( ( expiration_date . getTime ( ) - start . getTime ( ) ) / ( 24 * 60 * 60 * 1000 ) ) ;
860
+ const days_diff = Math . floor ( ( expiration . getTime ( ) - start . getTime ( ) ) / ( 24 * 60 * 60 * 1000 ) ) ;
857
861
858
862
return days_diff === delta_days && rule_id === expected_rule_id ;
859
863
}
0 commit comments