test/bin-test/test-dav-sync-hashing.sh

changeset 641
b138d1241e68
parent 640
65e40934b26c
child 649
0f4c59ac8c74
--- a/test/bin-test/test-dav-sync-hashing.sh	Sun Sep 08 15:43:13 2019 +0200
+++ b/test/bin-test/test-dav-sync-hashing.sh	Sun Sep 15 16:11:58 2019 +0200
@@ -388,3 +388,52 @@
 check_tmpout "0 conflicts" "test 12: wrong conflict counter (pull)"
 check_tmpout "0 errors" "test 12: wrong error counter (pull)"
 
+
+# ----------------------------------------------------------------------------
+# 13. test: delete file, change name of other file to deleted file's name
+# expected result: first file has content of second file, second file deleted
+
+# prepare
+echo "test13-file1" > tmp-sync/test2a/t13file1
+sleep 3 # make sure t13file2 doesn't has the same mtime as t13file1
+echo "test13-file2" > tmp-sync/test2a/t13file2
+
+dav_sync_push test2a "test 13: push failed (prepare)"
+check_tmpout "2 files pushed" "test 13: wrong push counter (prepare, push)"
+check_tmpout "0 conflicts" "test 13: wrong conflict counter (prepare, push)"
+check_tmpout "0 errors" "test 13: wrong error counter (prepare, push)"
+
+dav_sync_pull test2b "test 13: pull failed (prepare)"
+check_tmpout "2 files pulled" "test 13: wrong pull counter (prepare, pull)"
+check_tmpout "0 conflicts" "test 13: wrong conflict counter (prepare, pull)"
+check_tmpout "0 errors" "test 13: wrong error counter (prepare, pull)"
+
+# do test
+rm -f tmp-sync/test2a/t13file1
+mv tmp-sync/test2a/t13file2 tmp-sync/test2a/t13file1
+
+
+dav_sync_push test2a "test 13: push failed"
+# we can't check the exact output, because there are multiple valid ways
+# to sync the changes
+check_tmpout "0 conflicts" "test 13: wrong conflict counter (push)"
+check_tmpout "0 errors" "test 13: wrong error counter (push)"
+
+dav_sync_pull test2b "test 13: pull failed"
+check_tmpout "0 conflicts" "test 13: wrong conflict counter (pull)"
+check_tmpout "0 errors" "test 13: wrong error counter (pull)"
+
+TEST=`cat tmp-sync/test2b/t13file1`
+if  [ $TEST != "test13-file2" ]; then
+	echo "test 13: t13file1 has wrong content"
+	exit 2
+fi
+
+cat tmp-sync/test2b/t13file2 > /dev/null 2>&1
+if [ $? -eq 0 ]; then
+	echo "test 13: t13file2 not deleted"
+	exit 2
+fi
+
+
+

mercurial