Fix test_backup_restore_s3 after logging for native copying changed

Check profile events instead of some odd logs.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2023-06-28 10:58:23 +02:00
parent 84c720b33e
commit 29dc9abfca

View File

@ -244,9 +244,12 @@ def test_backup_to_s3_native_copy():
backup_destination = ( backup_destination = (
f"S3('http://minio1:9001/root/data/backups/{backup_name}', 'minio', 'minio123')" f"S3('http://minio1:9001/root/data/backups/{backup_name}', 'minio', 'minio123')"
) )
check_backup_and_restore(storage_policy, backup_destination) (backup_events, restore_events) = check_backup_and_restore(
assert node.contains_in_log("BackupWriterS3.*using native copy") storage_policy, backup_destination
assert node.contains_in_log("BackupReaderS3.*using native copy") )
# single part upload
assert backup_events["S3CopyObject"] > 0
assert restore_events["S3CopyObject"] > 0
assert node.contains_in_log( assert node.contains_in_log(
f"copyS3File: Single operation copy has completed. Bucket: root, Key: data/backups/{backup_name}" f"copyS3File: Single operation copy has completed. Bucket: root, Key: data/backups/{backup_name}"
) )
@ -258,9 +261,12 @@ def test_backup_to_s3_native_copy_other_bucket():
backup_destination = ( backup_destination = (
f"S3('http://minio1:9001/root/data/backups/{backup_name}', 'minio', 'minio123')" f"S3('http://minio1:9001/root/data/backups/{backup_name}', 'minio', 'minio123')"
) )
check_backup_and_restore(storage_policy, backup_destination) (backup_events, restore_events) = check_backup_and_restore(
assert node.contains_in_log("BackupWriterS3.*using native copy") storage_policy, backup_destination
assert node.contains_in_log("BackupReaderS3.*using native copy") )
# single part upload
assert backup_events["S3CopyObject"] > 0
assert restore_events["S3CopyObject"] > 0
assert node.contains_in_log( assert node.contains_in_log(
f"copyS3File: Single operation copy has completed. Bucket: root, Key: data/backups/{backup_name}" f"copyS3File: Single operation copy has completed. Bucket: root, Key: data/backups/{backup_name}"
) )
@ -270,9 +276,12 @@ def test_backup_to_s3_native_copy_multipart():
storage_policy = "policy_s3" storage_policy = "policy_s3"
backup_name = new_backup_name() backup_name = new_backup_name()
backup_destination = f"S3('http://minio1:9001/root/data/backups/multipart/{backup_name}', 'minio', 'minio123')" backup_destination = f"S3('http://minio1:9001/root/data/backups/multipart/{backup_name}', 'minio', 'minio123')"
check_backup_and_restore(storage_policy, backup_destination, size=1000000) (backup_events, restore_events) = check_backup_and_restore(
assert node.contains_in_log("BackupWriterS3.*using native copy") storage_policy, backup_destination, size=1000000
assert node.contains_in_log("BackupReaderS3.*using native copy") )
# multi part upload
assert backup_events["S3CreateMultipartUpload"] > 0
assert restore_events["S3CreateMultipartUpload"] > 0
assert node.contains_in_log( assert node.contains_in_log(
f"copyS3File: Multipart upload has completed. Bucket: root, Key: data/backups/multipart/{backup_name}/" f"copyS3File: Multipart upload has completed. Bucket: root, Key: data/backups/multipart/{backup_name}/"
) )