summaryrefslogtreecommitdiff
path: root/test/test_e2e.py
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2023-08-04 15:06:14 +0900
committerRyo Nakamura <upa@haeena.net>2023-08-04 15:06:14 +0900
commit24c1bc9149eb8f1c383eaf16d94636b62d07c152 (patch)
tree54dd5823cb8255a493a851e4ecec74aeae675370 /test/test_e2e.py
parent16f2f88cc91ffa2421393b077611d55d6cd2b771 (diff)
do not set O_TRUNC when opening destination file.
It prevents `mscp localhost:hoge ~/hoge` from truncating the source file. See https://bugzilla.mindrot.org/show_bug.cgi?id=3431. https://github.com/upa/mscp/issues/1
Diffstat (limited to 'test/test_e2e.py')
-rw-r--r--test/test_e2e.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_e2e.py b/test/test_e2e.py
index 841c3be..c63a09e 100644
--- a/test/test_e2e.py
+++ b/test/test_e2e.py
@@ -227,6 +227,15 @@ def test_override_dst_having_larger_size(mscp, src_prefix, dst_prefix):
src.cleanup()
dst.cleanup()
+@pytest.mark.parametrize("src_prefix, dst_prefix", param_remote_prefix)
+def test_dont_truncate_dst(mscp, src_prefix, dst_prefix):
+ f = File("srcanddst", size = 1024 * 1024 * 128).make()
+ md5_before = f.md5sum()
+ run2ok([mscp, "-H", "-vvv", src_prefix + f.path, dst_prefix + f.path])
+ md5_after = f.md5sum()
+ assert md5_before == md5_after
+ f.cleanup()
+
compressions = ["yes", "no", "none"]
@pytest.mark.parametrize("src_prefix, dst_prefix", param_remote_prefix)
@pytest.mark.parametrize("compress", compressions)