@@ -692,7 +692,6 @@ def create_faux_backup_file(backups_dir, file_prefix)
692692 let! ( :temp_backups_dir ) { Dir . mktmpdir ( 'faux-backups-dir' ) }
693693 let! ( :faux_backup_fn ) { create_faux_backup_file ( temp_backups_dir , 'faux_backup.bak' ) }
694694
695-
696695 it '.upload_file_to_s3 calls .upload_file for the bucket, full object name, and file to upload' do
697696 expect ( mock_bucket_object ) . to receive ( :upload_file ) . with ( faux_backup_fn , anything )
698697 Backup . upload_file_to_s3 ( mock_s3 , bucket_name , bucket_full_prefix , faux_backup_fn )
@@ -1251,7 +1250,9 @@ def create_faux_backup_file(backups_dir, file_prefix)
12511250
12521251
12531252 describe 'iterate_and_log_notify_errors(list, slack_error_details, log)' do
1254-
1253+ let ( :status ) { 'Enabled' }
1254+ let ( :storage_rules ) { [ { days : 30 , storage_class : 'STANDARD_IA' } , { days : 90 , storage_class : 'GLACIER' } ] }
1255+
12551256 before ( :each ) do
12561257 allow ( SHFNotifySlack ) . to receive ( :failure_notification )
12571258 . with ( anything , anything )
@@ -1303,9 +1304,14 @@ def create_faux_backup_file(backups_dir, file_prefix)
13031304 expect ( @result_str ) . to eq 'ac'
13041305 end
13051306
1307+ it 'adds a bucket lifecycle policy to the object' do
1308+ expect ( described_class ) . to receive ( :set_s3_lifecycle_rules ) . with ( bucket_name : bucket_name , bucket_full_prefix : bucket_full_prefix , status : status , storage_rules : storage_rules )
1309+ described_class . set_s3_lifecycle_rules ( bucket_name : bucket_name , bucket_full_prefix : bucket_full_prefix , status : status , storage_rules : storage_rules )
1310+ end
1311+
13061312 end
13071313
1308- describe 's3_lifecycle_rules (bucket, bucket_full_prefix, status, *storage_rules_kwargs)' do
1314+ describe 'set_s3_lifecycle_rules (bucket, bucket_full_prefix, status, *storage_rules_kwargs)' do
13091315 let ( :invalid_storage_class_list ) { [ 'INVALID_STORAGE_CLASS' , 'OTHER_INVALID_STORAGE_CLASS' ] }
13101316 let ( :another_invalid_storage_class_list ) { [ 'INVALID_STORAGE_CLASS' , 'STANDARD_IA' , 'GLACIER' ] }
13111317 let ( :status ) { 'Enabled' }
@@ -1323,9 +1329,9 @@ def create_faux_backup_file(backups_dir, file_prefix)
13231329 client
13241330 end
13251331
1326- it 'calls #s3_lifecycle_rules once' do
1327- expect ( described_class ) . to receive ( :s3_lifecycle_rules ) . with ( bucket_name : bucket_name , bucket_full_prefix : bucket_full_prefix , status : status , storage_rules : storage_rules )
1328- described_class . s3_lifecycle_rules ( bucket_name : bucket_name , bucket_full_prefix : bucket_full_prefix , status : status , storage_rules : storage_rules )
1332+ it 'calls #set_s3_lifecycle_rules once' do
1333+ expect ( described_class ) . to receive ( :set_s3_lifecycle_rules ) . with ( bucket_name : bucket_name , bucket_full_prefix : bucket_full_prefix , status : status , storage_rules : storage_rules )
1334+ described_class . set_s3_lifecycle_rules ( bucket_name : bucket_name , bucket_full_prefix : bucket_full_prefix , status : status , storage_rules : storage_rules )
13291335 end
13301336
13311337 it "returns 'Invalid storage class' for a list containing only invalid storage classes" do
0 commit comments