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

changeset 638
b3077bdb3d77
parent 637
20241338740c
child 639
928a77ebe0b9
--- a/test/bin-test/test-dav-sync-hashing.sh	Wed Sep 04 19:28:10 2019 +0200
+++ b/test/bin-test/test-dav-sync-hashing.sh	Sat Sep 07 17:45:50 2019 +0200
@@ -90,7 +90,7 @@
 mkdir tmp-sync/test2b
 
 # ----------------------------------------------------------------------------
-# 1. test: add 4 files, push, pull
+# 1. test: add 4 files, push, pull (not really an hashing test)
 # expected result: 4 files pushed, 4 files pulled
 
 mkdir tmp-sync/test2a/dir1/
@@ -112,4 +112,53 @@
 check_tmpout "0 errors" "test 1: wrong error counter (pull)"
 
 
+# ----------------------------------------------------------------------------
+# 2. test: touch 2 files, push
+# expected result: 0 files pushed
 
+sleep 3
+
+touch tmp-sync/test2a/file1
+touch tmp-sync/test2a/dir1/file2
+
+dav_sync_push test2a "test 2: push failed"
+check_tmpout "0 files pushed" "test 2: wrong push counter"
+check_tmpout "0 conflicts" "test 2: wrong conflict counter"
+check_tmpout "0 errors" "test 2: wrong error counter"
+
+
+# ----------------------------------------------------------------------------
+# 3. test: copy fil1 to test2a again
+# expected result: 0 files pushed
+
+sleep 3
+
+cp synctest/file1 tmp-sync/test2a/
+
+dav_sync_push test2a "test 3: push failed"
+check_tmpout "0 files pushed" "test 3: wrong push counter"
+check_tmpout "0 conflicts" "test 3: wrong conflict counter"
+check_tmpout "0 errors" "test 3: wrong error counter"
+
+
+# ----------------------------------------------------------------------------
+# 4. test: change content but don't change mtime
+# expected result: 1 file pushed
+
+# modify file and mtime to update mtime in the database
+echo "test4-change1-a" >> tmp-sync/test2a/file1
+touch -t 01011200 tmp-sync/test2a/file1
+
+dav_sync_push test2a "test 4: push failed (1)"
+check_tmpout "1 file pushed" "test 4: wrong push counter (1)"
+check_tmpout "0 conflicts" "test 4: wrong conflict counter (1)"
+check_tmpout "0 errors" "test 4: wrong error counter (1)"
+
+# modify file again and set mtime to same value
+echo "test4-change2-a" >> tmp-sync/test2a/file1
+touch -t 01011200 tmp-sync/test2a/file1
+
+dav_sync_push test2a "test 4: push failed (2)"
+check_tmpout "1 file pushed" "test 4: wrong push counter (2)"
+check_tmpout "0 conflicts" "test 4: wrong conflict counter (2)"
+check_tmpout "0 errors" "test 4: wrong error counter (2)"

mercurial