add more simple dav-sync push tests

Sun, 21 Apr 2019 12:17:53 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 21 Apr 2019 12:17:53 +0200
changeset 586
b45719a52ea6
parent 585
41368a355222
child 587
3c917df041b8

add more simple dav-sync push tests

test/bin-test/test-dav-sync-push1.sh file | annotate | diff | comparison | revisions
--- a/test/bin-test/test-dav-sync-push1.sh	Sun Apr 21 11:27:06 2019 +0200
+++ b/test/bin-test/test-dav-sync-push1.sh	Sun Apr 21 12:17:53 2019 +0200
@@ -67,7 +67,7 @@
 $DAV_BIN mkcol dav-test-repo/sync/test1
 
 # 1. test
-# copy to files to the test1a dir and run push
+# copy files to the test1a dir and run push
 # expected result: 2 uploads, no errors or conflicts
 
 cp synctest/file1 tmp-sync/test1a
@@ -156,3 +156,102 @@
 check_tmpout "0 files deleted" "push 5: wrong delete counter"
 check_tmpout "0 errors" "push 5: wrong error counter"
 
+# 6. test
+# add deep dir hierarchy and some files, test if mkcol order is fine
+# expected result: multiple mkcol requests and some puts after that
+mkdir -p tmp-sync/test1a/dir_a/1/2/3/4/5/6/7/8
+mkdir -p tmp-sync/test1a/dir_a/1/2/3/a/b/c/d
+mkdir -p tmp-sync/test1a/dir_a/i/j/k
+mkdir -p tmp-sync/test1a/dir_b/1/2/3/4/5/6/7/8
+mkdir -p tmp-sync/test1a/dir_b/1/2/3/a/b/c/d
+mkdir -p tmp-sync/test1a/dir_b/i/j/k
+mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/sub3/sub4
+mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/1
+mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/2
+mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/3
+mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/4
+mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/5
+mkdir -p tmp-sync/test1a/dir_c/sub_a/x
+mkdir -p tmp-sync/test1a/dir_c/sub_a/y/d1/d2/d3
+touch tmp-sync/test1a/dir_a/1/2/3/4/5/6/7/8/file1
+touch tmp-sync/test1a/dir_a/1/2/3/4/5/6/7/file1
+touch tmp-sync/test1a/dir_a/1/2/3/4/5/6/file1
+touch tmp-sync/test1a/dir_a/1/2/3/a/b/c/d/d_file1
+touch tmp-sync/test1a/dir_a/1/2/3/a/b/b_file1
+touch tmp-sync/test1a/dir_a/a_file
+echo "test6-file-1" > tmp-sync/test1a/dir_b/1/2/3/4/5/6/7/8/t6f1-8
+echo "test6-file-2" > tmp-sync/test1a/dir_b/i/t6f2-i
+echo "test6-file-3" > tmp-sync/test1a/dir_c/sub1/sub2/sub3/sub4/t6f3-s4
+echo "test6-file-4" > tmp-sync/test1a/dir_c/sub1/sub2/3/t6f4-3
+
+dav_sync_push test1a "push 6 failed"
+check_tmpout "10 files pushed" "push6: wrong push counter"
+check_tmpout "0 files deleted" "push6: wrong delete counter"
+check_tmpout "0 conflicts" "push6: wrong conflict counter"
+check_tmpout "0 errors" "push6: wrong error counter"
+OUT=`grep mkcol tmp-sync/out.txt | wc -l`
+if [ "$OUT" != "48" ];
+then	
+	echo "push 6: number of mkcol output lines not 48"
+	exit 2
+fi
+
+# 7. test
+# delete file
+# expected result: delete file on server
+rm -f tmp-sync/test1a/file1
+
+dav_sync_push test1a "push 7 failed"
+check_tmpout "0 files pushed" "push7: wrong push counter"
+check_tmpout "1 file deleted" "push7: wrong delete counter"
+check_tmpout "0 conflicts" "push7: wrong conflict counter"
+check_tmpout "0 errors" "push7: wrong error counter"
+
+# 8. test
+# do nothing, test if double delete happens
+# expected result: no delete
+
+dav_sync_push test1a "push 8 failed"
+check_tmpout "0 files pushed" "push8: wrong push counter"
+check_tmpout "0 files deleted" "push8: wrong delete counter"
+check_tmpout "0 conflicts" "push8: wrong conflict counter"
+check_tmpout "0 errors" "push8: wrong error counter"
+
+# 9. test
+# delete multiple files
+# expected result: multiple delete requests
+
+rm -Rf tmp-sync/test1a/dir_a
+rm -f tmp-sync/test1a/dir_b/1/2/3/4/5/6/7/8/t6f1-8
+rm -f tmp-sync/test1a/dir_b/i/t6f2-i
+
+dav_sync_push test1a "push 9 failed"
+
+# don't test if there was a single delete for each collection
+# and don't check if the delete counter has a specific value
+# because maybe there will be some optimizations 
+check_tmpout "0 files pushed" "push8: wrong push counter"
+check_tmpout "0 conflicts" "push8: wrong conflict counter"
+check_tmpout "0 errors" "push8: wrong error counter"
+
+OUT=`grep "delete: /dir_a/" tmp-sync/out.txt`
+if [ $? -ne 0 ];
+then
+	echo "missing: delete /dir_a/"
+	exit 2
+fi
+OUT=`grep "delete: /dir_b/i/t6f2-i" tmp-sync/out.txt`
+if [ $? -ne 0 ];
+then
+	echo "missing: delete: /dir_b/i/t6f2-i"
+	exit 2
+fi
+OUT=`grep "delete: /dir_b/1/2/3/4/5/6/7/8/t6f1-8" tmp-sync/out.txt`
+if [ $? -ne 0 ];
+then
+	echo "missing: delete: /dir_b/1/2/3/4/5/6/7/8/t6f1-8"
+	exit 2
+fi
+
+
+

mercurial