Sun, 08 Sep 2019 15:43:13 +0200
add some copy/move tests
test/bin-test/test-dav-sync-hashing.sh | file | annotate | diff | comparison | revisions | |
test/bin-test/test-dav-sync.sh | file | annotate | diff | comparison | revisions |
--- a/test/bin-test/test-dav-sync-hashing.sh Sat Sep 07 19:25:51 2019 +0200 +++ b/test/bin-test/test-dav-sync-hashing.sh Sun Sep 08 15:43:13 2019 +0200 @@ -188,3 +188,203 @@ # don't check push counter check_tmpout "0 conflicts" "test 5: wrong conflict counter (test2b)" check_tmpout "0 errors" "test 5: wrong error counter (test2b)" + + +# ---------------------------------------------------------------------------- +# 6. test: upload same new file on both sides +# expected result: no conflict + +echo "test6-newfile" >> tmp-sync/test2a/newfile1 +echo "test6-newfile" >> tmp-sync/test2b/newfile1 + +# push both sides +dav_sync_push test2a "test 6: push failed (test2a)" +check_tmpout "1 file pushed" "test 6: wrong push counter (test2a)" +check_tmpout "0 conflicts" "test 6: wrong conflict counter (test2a)" +check_tmpout "0 errors" "test 6: wrong error counter (test2a)" + +dav_sync_push test2b "test 6: push failed (test2b)" +# don't check push counter +check_tmpout "0 conflicts" "test 6: wrong conflict counter (test2b)" +check_tmpout "0 errors" "test 6: wrong error counter (test2b)" + + +# ---------------------------------------------------------------------------- +# 7. test: rename file +# expected result: move + +mv tmp-sync/test2a/newfile1 tmp-sync/test2a/move1 + +dav_sync_push test2a "test 7: push failed" +check_tmpout "move:" "test 7: no move" +check_tmpout "0 conflicts" "test 7: wrong conflict counter" +check_tmpout "0 errors" "test 7: wrong error counter" + + +# ---------------------------------------------------------------------------- +# 8. test: copy file +# expected result: copy + +cp tmp-sync/test2a/file1 tmp-sync/test2a/copy1 + +dav_sync_push test2a "test 8: push failed" +check_tmpout "copy:" "test 8: no move" +check_tmpout "0 conflicts" "test 8: wrong conflict counter" +check_tmpout "0 errors" "test 8: wrong error counter" + + +# ---------------------------------------------------------------------------- +# 9. test: copy file1 multiple times and than delete it +# expected result: multiple copies, maybe one move, no errors + +echo "test9-change" >> tmp-sync/test2a/file1 +dav_sync_push test2a "test 9: push failed (prepare)" +check_tmpout "1 file pushed" "test 9: wrong push counter (prepare)" +check_tmpout "0 conflicts" "test 9: wrong conflict counter (prepare)" +check_tmpout "0 errors" "test 9: wrong error counter (prepare)" + +cp tmp-sync/test2a/file1 tmp-sync/test2a/copyx1 +cp tmp-sync/test2a/file1 tmp-sync/test2a/copyx2 +cp tmp-sync/test2a/file1 tmp-sync/test2a/copyx3 +cp tmp-sync/test2a/file1 tmp-sync/test2a/copyx4 +cp tmp-sync/test2a/file1 tmp-sync/test2a/copyx5 +rm -f tmp-sync/test2a/file1 + +dav_sync_push test2a "test 9: push failed" +check_tmpout "copy:" "test 9: no move" +check_tmpout "0 conflicts" "test 9: wrong conflict counter" +check_tmpout "0 errors" "test 9: wrong error counter" + +# to check if everything worked, pull test2b and check the files + +dav_sync_pull test2b +check_tmpout "0 conflicts" "test 9: wrong conflict counter (pull)" +check_tmpout "0 errors" "test 9: wrong error counter (pull)" + +cat tmp-sync/test2b/file1 > /dev/null 2>&1 +if [ $? -eq 0 ]; then + echo "test 9: file1 not deleted (pull)" + exit 2 +fi + +diff tmp-sync/test2a/copyx1 tmp-sync/test2b/copyx1 > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "test 9: copyx1 missing or wrong content" + exit 2 +fi +diff tmp-sync/test2a/copyx2 tmp-sync/test2b/copyx2 > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "test 9: copyx2 missing or wrong content" + exit 2 +fi +diff tmp-sync/test2a/copyx3 tmp-sync/test2b/copyx3 > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "test 9: copyx3 missing or wrong content" + exit 2 +fi +diff tmp-sync/test2a/copyx4 tmp-sync/test2b/copyx4 > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "test 9: copyx4 missing or wrong content" + exit 2 +fi +diff tmp-sync/test2a/copyx5 tmp-sync/test2b/copyx5 > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "test 9: copyx5 missing or wrong content" + exit 2 +fi + + +# ---------------------------------------------------------------------------- +# 10. test: rename all copyx files, which will have all the same content hash +# we don't test if everything is moved (instead of deleted), but to make sure +# no errors occur when working with files with the same content +# expected result: no errors + +mv tmp-sync/test2a/copyx1 tmp-sync/test2a/movex1 +mv tmp-sync/test2a/copyx2 tmp-sync/test2a/movex2 +mv tmp-sync/test2a/copyx3 tmp-sync/test2a/movex3 +mv tmp-sync/test2a/copyx4 tmp-sync/test2a/movex4 +mv tmp-sync/test2a/copyx5 tmp-sync/test2a/movex5 + +dav_sync_push test2a "test 10: push failed" +check_tmpout "move:" "test 10: no move" +check_tmpout "0 conflicts" "test 10: wrong conflict counter" +check_tmpout "0 errors" "test 10: wrong error counter" + +# to check if everything worked, pull test2b and check the files + +dav_sync_pull test2b +check_tmpout "0 conflicts" "test 9: wrong conflict counter (pull)" +check_tmpout "0 errors" "test 9: wrong error counter (pull)" + +diff tmp-sync/test2a/movex1 tmp-sync/test2b/movex1 > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "test 10: movex1 missing or wrong content" + exit 2 +fi +diff tmp-sync/test2a/movex2 tmp-sync/test2b/movex2 > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "test 10: movex2 missing or wrong content" + exit 2 +fi +diff tmp-sync/test2a/movex3 tmp-sync/test2b/movex3 > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "test 10: movex3 missing or wrong content" + exit 2 +fi +diff tmp-sync/test2a/movex4 tmp-sync/test2b/movex4 > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "test 10: movex4 missing or wrong content" + exit 2 +fi +diff tmp-sync/test2a/movex5 tmp-sync/test2b/movex5 > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "test 10: movex5 missing or wrong content" + exit 2 +fi + + +# ---------------------------------------------------------------------------- +# 11. test: copy file, push test2a, pull test2b +# expected result: pull copies file + +cp tmp-sync/test2a/movex5 tmp-sync/test2a/newcopyt11 +dav_sync_push test2a "test 11: push failed" +check_tmpout "copy:" "test 11: no copy (push)" +check_tmpout "0 conflicts" "test 11: wrong conflict counter (push)" +check_tmpout "0 errors" "test 11: wrong error counter (push)" + +dav_sync_pull test2b "test 11: pull failed" +check_tmpout "copy:" "test 11: no copy (pull)" +check_tmpout "0 conflicts" "test 11: wrong conflict counter (pull)" +check_tmpout "0 errors" "test 11: wrong error counter (pull)" + + +# ---------------------------------------------------------------------------- +# 12. test: move file, push test2a, pull test2b +# expected result: pull moves file + +# we need a fresh file with new content hash for this test +echo "test12-newfile" >> tmp-sync/test2a/t12file1 +dav_sync_push test2a "test 12: push failed (prepare)" +check_tmpout "1 file pushed" "test 12: wrong push counter (prepare)" +check_tmpout "0 conflicts" "test 12: wrong conflict counter (push, prepare)" +check_tmpout "0 errors" "test 12: wrong error counter (push, prepare)" + +dav_sync_pull test2b "test 12: pull failed (prepare)" +check_tmpout "1 file pulled" "test 12: wrong pull counter (prepare)" +check_tmpout "0 conflicts" "test 12: wrong conflict counter (pull, prepare)" +check_tmpout "0 errors" "test 12: wrong error counter (pull, prepare)" + +# actual test +mv tmp-sync/test2a/t12file1 tmp-sync/test2a/t12move1 +dav_sync_push test2a "test 12: push failed" +check_tmpout "move:" "test 12: no copy (push)" +check_tmpout "0 conflicts" "test 12: wrong conflict counter (push)" +check_tmpout "0 errors" "test 12: wrong error counter (push)" + +dav_sync_pull test2b "test 12: pull failed" +check_tmpout "move:" "test 12: no move (pull)" +check_tmpout "0 conflicts" "test 12: wrong conflict counter (pull)" +check_tmpout "0 errors" "test 12: wrong error counter (pull)" +
--- a/test/bin-test/test-dav-sync.sh Sat Sep 07 19:25:51 2019 +0200 +++ b/test/bin-test/test-dav-sync.sh Sun Sep 08 15:43:13 2019 +0200 @@ -94,9 +94,9 @@ # ok, begin the tests # do_test "dav-sync push (1)" test-dav-sync-push1.sh -do_test "dav-sync pull (1)" test-dav-sync-pull1.sh -do_test "dav-sync pull conflict (1)" test-dav-sync-pull-conflict.sh -do_test "dav-sync push conflict (1)" test-dav-sync-push-conflict.sh +#do_test "dav-sync pull (1)" test-dav-sync-pull1.sh +#do_test "dav-sync pull conflict (1)" test-dav-sync-pull-conflict.sh +#do_test "dav-sync push conflict (1)" test-dav-sync-push-conflict.sh do_test "dav-sync hashing" test-dav-sync-hashing.sh # cleanup