X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=test.sh;h=dafa4a6e721f413ff83a57131651d03895084d02;hb=4a81a3e92a6319f13b9cce561065bcc4b450c417;hp=7889eec0dd41e59bb8f1fb3f005eb8d7f0ab1d7d;hpb=2a4ae3fb4b06bdc526154fb5d4cfb832d7b622fa;p=cloudstore.git diff --git a/test.sh b/test.sh index 7889eec..dafa4a6 100755 --- a/test.sh +++ b/test.sh @@ -1,5 +1,74 @@ -#!/bin/sh +#!/bin/sh -xe -ps ax > /tmp/foo -RSYNC_PASSWORD=secret rsync /tmp/foo rsync://dpavlin@127.0.0.1:6501/dpavlin -RSYNC_PASSWORD=secret rsync rsync://dpavlin@127.0.0.1:6501/dpavlin/foo /tmp/foo +user_dir=/srv/cloudstore/users/test/ +rm -Rvf $user_dir/log/* #$user_dir/blob/* + +push() { + file=`shift` + RSYNC_PASSWORD=secret rsync $* $file rsync://test+localhost@127.0.0.1:6501/test/$file +} +pull() { + from=$1 + to=$2 + test -z "$to" && to=$1 + RSYNC_PASSWORD=secret rsync rsync://test+localhost@127.0.0.1:6501/test/$from $to +} + + +./remove-user.sh test + +./create-user.sh test secret +./create-user.sh test secret localhost + +dir=/tmp/test +rm -Rf "$dir" +mkdir /tmp/test +cd $dir +push . --recursive --delete -v +ps ax > foo +push foo -v +push foo -v +ps ax > bar +push bar -v +touch --date='2000-01-01' bar +push bar -v +pull bar baz +push baz -v +ps ax >> baz +push baz -v +cp baz baz2 +push baz baz2 -v + +mkdir dir-test +# deduplicate? +cp foo bar dir-test/ +uptime > "dir-test/file with spaces" +push dir-test --recursive -v + +find . type -f | xargs -i md5sum {} > /tmp/md5sum + +rm foo bar +push dir-test --recursive --delete -v +rm -Rf dir-test + +pull non-existing || true + +cp /tmp/md5sum md5sum +mkdir clone +# test md5 import from directory +mv md5sum clone/ +push clone -r -v +# client should hardlink or copy files locally to avoid wastefull pull +# but we test server-side hardlink here +pull clone -r -v + +md5sum clone/* | sed -e 's! ! _import/foo/bar/baz!' > md5sum +cat md5sum +push md5sum -v + +tail -20 $user_dir/log/* + +#diff -urw $user_dir/blob $dir/ +#diff -urw $user_dir/json $dir/ + +ls -al $user_dir/blob