DEV: Skip logging in test environment (#14971)

It adds unnecessary noise when running the test suite.
This commit is contained in:
Osama Sayegh 2021-11-16 18:01:48 +03:00 committed by GitHub
parent 035822d9e0
commit 8f5412cccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -49,19 +49,25 @@ class S3CorsRulesets
s3_helper = S3Helper.build_from_config( s3_helper = S3Helper.build_from_config(
s3_client: s3_client, use_db_s3_config: use_db_s3_config s3_client: s3_client, use_db_s3_config: use_db_s3_config
) )
puts "Attempting to apply ASSETS S3 CORS ruleset in bucket #{s3_helper.s3_bucket_name}." if !Rails.env.test?
puts "Attempting to apply ASSETS S3 CORS ruleset in bucket #{s3_helper.s3_bucket_name}."
end
assets_rules_status = s3_helper.ensure_cors!([S3CorsRulesets::ASSETS]) ? RULE_STATUS_APPLIED : RULE_STATUS_EXISTED assets_rules_status = s3_helper.ensure_cors!([S3CorsRulesets::ASSETS]) ? RULE_STATUS_APPLIED : RULE_STATUS_EXISTED
if SiteSetting.enable_backups? && SiteSetting.backup_location == BackupLocationSiteSetting::S3 if SiteSetting.enable_backups? && SiteSetting.backup_location == BackupLocationSiteSetting::S3
backup_s3_helper = S3Helper.build_from_config( backup_s3_helper = S3Helper.build_from_config(
s3_client: s3_client, use_db_s3_config: use_db_s3_config, for_backup: true s3_client: s3_client, use_db_s3_config: use_db_s3_config, for_backup: true
) )
puts "Attempting to apply BACKUP_DIRECT_UPLOAD S3 CORS ruleset in bucket #{backup_s3_helper.s3_bucket_name}." if !Rails.env.test?
puts "Attempting to apply BACKUP_DIRECT_UPLOAD S3 CORS ruleset in bucket #{backup_s3_helper.s3_bucket_name}."
end
backup_rules_status = backup_s3_helper.ensure_cors!([S3CorsRulesets::BACKUP_DIRECT_UPLOAD]) ? RULE_STATUS_APPLIED : RULE_STATUS_EXISTED backup_rules_status = backup_s3_helper.ensure_cors!([S3CorsRulesets::BACKUP_DIRECT_UPLOAD]) ? RULE_STATUS_APPLIED : RULE_STATUS_EXISTED
end end
if SiteSetting.enable_direct_s3_uploads if SiteSetting.enable_direct_s3_uploads
puts "Attempting to apply DIRECT_UPLOAD S3 CORS ruleset in bucket #{s3_helper.s3_bucket_name}." if !Rails.env.test?
puts "Attempting to apply DIRECT_UPLOAD S3 CORS ruleset in bucket #{s3_helper.s3_bucket_name}."
end
direct_upload_rules_status = s3_helper.ensure_cors!([S3CorsRulesets::DIRECT_UPLOAD]) ? RULE_STATUS_APPLIED : RULE_STATUS_EXISTED direct_upload_rules_status = s3_helper.ensure_cors!([S3CorsRulesets::DIRECT_UPLOAD]) ? RULE_STATUS_APPLIED : RULE_STATUS_EXISTED
end end