Skip to content

Commit

Permalink
Verify file content write via MPU
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghua committed Sep 21, 2024
1 parent 000eed9 commit ef221b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tosfs/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion tosfs/tests/test_tosfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ef221b7

Please sign in to comment.