From ef221b70a243d4351b729387677f656325503323 Mon Sep 17 00:00:00 2001 From: yanghua Date: Sat, 21 Sep 2024 11:13:47 +0800 Subject: [PATCH] Verify file content write via MPU --- tosfs/tests/conftest.py | 2 ++ tosfs/tests/test_tosfs.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tosfs/tests/conftest.py b/tosfs/tests/conftest.py index 8ffd0fa..16d5661 100644 --- a/tosfs/tests/conftest.py +++ b/tosfs/tests/conftest.py @@ -38,6 +38,8 @@ def tosfs(_tosfs_env_prepare: None) -> TosFileSystem: endpoint_url=os.environ.get("TOS_ENDPOINT"), region=os.environ.get("TOS_REGION"), credentials_provider=EnvCredentialsProvider(), + multipart_size=4 << 20, + multipart_threshold=4 << 20, ) return tosfs diff --git a/tosfs/tests/test_tosfs.py b/tosfs/tests/test_tosfs.py index 7837305..5f1bd31 100644 --- a/tosfs/tests/test_tosfs.py +++ b/tosfs/tests/test_tosfs.py @@ -767,7 +767,7 @@ def test_file_write_mpu( file_name = random_str() # mock a content let the write logic trigger mpu: - content = "a" * 13 * 1024 * 1024 + content = random_str(13 * 1024 * 1024) block_size = 4 * 1024 * 1024 with tosfs.open( f"{bucket}/{temporary_workspace}/{file_name}", "w", block_size=block_size @@ -778,6 +778,9 @@ def test_file_write_mpu( content ) + with tosfs.open(f"{bucket}/{temporary_workspace}/{file_name}", "r") as f: + assert f.read() == content + def test_file_write_mpu_threshold_check( tosfs: TosFileSystem, bucket: str, temporary_workspace: str