From 45cee34e38f629ca0946743a343adbff41015b19 Mon Sep 17 00:00:00 2001
From: yanghua <yanghua1127@gmail.com>
Date: Tue, 24 Sep 2024 22:56:04 +0800
Subject: [PATCH] Add test cases for stability

---
 tosfs/tests/test_stability.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tosfs/tests/test_stability.py b/tosfs/tests/test_stability.py
index 443fc33..cb625a4 100644
--- a/tosfs/tests/test_stability.py
+++ b/tosfs/tests/test_stability.py
@@ -19,8 +19,8 @@
 
 def test_write_breakpoint_continuation(tosfs, bucket, temporary_workspace):
     file_name = f"{random_str()}.txt"
-    first_part = random_str(10 * 1024 * 1024)
-    second_part = random_str(10 * 1024 * 1024)
+    first_part = random_str(9 * 1024 * 1024)
+    second_part = random_str(9 * 1024 * 1024)
 
     with tosfs.open(f"{bucket}/{temporary_workspace}/{file_name}", "w") as f:
         f.write(first_part)
@@ -28,24 +28,24 @@ def test_write_breakpoint_continuation(tosfs, bucket, temporary_workspace):
         sleep(60)
         f.write(second_part)
 
-    with tosfs.open(file_name, "r") as f:
+    with tosfs.open(f"{bucket}/{temporary_workspace}/{file_name}", "r") as f:
         assert f.read() == first_part + second_part
 
 
 def test_read_breakpoint_continuation(tosfs, bucket, temporary_workspace):
     file_name = f"{random_str()}.txt"
-    first_part = random_str(10 * 1024 * 1024)
-    second_part = random_str(10 * 1024 * 1024)
+    first_part = random_str(9 * 1024 * 1024)
+    second_part = random_str(9 * 1024 * 1024)
 
     with tosfs.open(f"{bucket}/{temporary_workspace}/{file_name}", "w") as f:
         f.write(first_part)
         f.write(second_part)
 
-    with tosfs.open(file_name, "r") as f:
-        read_first_part = f.read(10 * 1024 * 1024)
+    with tosfs.open(f"{bucket}/{temporary_workspace}/{file_name}", "r") as f:
+        read_first_part = f.read(9 * 1024 * 1024)
         assert read_first_part == first_part
         # mock a very long block(business processing or network issue)
         sleep(60)
-        read_second_part = f.read(10 * 1024 * 1024)
+        read_second_part = f.read(9 * 1024 * 1024)
         assert read_second_part == second_part
         assert read_first_part + read_second_part == first_part + second_part