X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=test.sh;h=8518ecfaee8cae4fe896a246efdbd1401de07fb3;hb=41187c9904153b484a817883805fb8ad6a206b40;hp=c6b2e04f6a745efbb999cb0f4ed13b722b646ffc;hpb=b78002bb37ed4ad3d42eef83342ceaaea683953b;p=cloudstore.git diff --git a/test.sh b/test.sh index c6b2e04..8518ecf 100755 --- a/test.sh +++ b/test.sh @@ -1,9 +1,6 @@ #!/bin/sh -xe -user_dir=/srv/cloudstore/users/test/ -rm -Rvf $user_dir/log/* #$user_dir/blob/* - -RSYNC_LOGIN=u2000 +RSYNC_LOGIN=fake push() { file=`shift` @@ -17,20 +14,24 @@ pull() { } -sudo ./remove-user.sh test@example.com -sudo ./remove-user.sh test2@example.com +#sudo ./remove-user.sh test@example.com +#sudo ./remove-user.sh test2@example.com +base_dir=`pwd` + +RSYNC_LOGIN=`sudo ./create-user.sh test@example.com secret 500000` +RSYNC_LOGIN2=`sudo ./create-user.sh test2@example.com secret 100000` -RSYNC_LOGIN=`sudo ./create-user.sh test@example.com secret 500k` -RSYNC_LOGIN2=`sudo ./create-user.sh test2@example.com secret 20k` +. ./env.sh dir=/tmp/test rm -Rf "$dir" mkdir /tmp/test cd $dir -if true ; then # skip tests if false - push . --recursive --delete -v + +if [ ! -z "$ALL" ] ; then # skip tests if false + ps ax > foo push foo -v push foo -v @@ -72,8 +73,6 @@ md5sum clone/* | sed -e 's! ! _import/foo/bar/baz!' > md5sum cat md5sum push md5sum -v -fi # skip tests - # test unused md5 pool quota ps ax > tmp @@ -81,14 +80,57 @@ push tmp -v rm tmp push . -r --delete -v +# test send + +ps ax >> send +mkdir dir1 +ps ax >> dir1/send +mkdir dir2 +ps ax >> dir2/send + +mkdir -p .sync/send +cat << __SEND__ > .sync/send/timestamp +$RSYNC_LOGIN2 send +$RSYNC_LOGIN2 dir1/send +$RSYNC_LOGIN2 dir2/send +__SEND__ + +# order is important! .sync must be last! +push send dir1 dir2 .sync -rv + +# test receiving of sent files +mkdir /tmp/test/$RSYNC_LOGIN2 +RSYNC_PASSWORD=secret rsync -rv rsync://$RSYNC_LOGIN2@127.0.0.1:6501/$RSYNC_LOGIN2/received/ /tmp/test/$RSYNC_LOGIN2 + +fi # skip tests + +# test file move + +ps ax > Jellyfish.jpg +push Jellyfish.jpg + +mkdir -p .sync/pending +cat << __pending__ > .sync/pending/test +MOVED#Jellyfish.jpg#Photos with space/Jellyfish cool.jpg +DELETED#Photos with space/Jellyfish cool.jpg +DELETED#Photos with space +__pending__ + +push .sync -rv + exit -# test send +ps ax > perms-test +chmod 400 perms-test +push -va perms-test + +sudo sh -xc "ls -al ~$RSYNC_LOGIN/localhost/" + + + -ps ax >> sent-to-$RSYNC_LOGIN2 -push sent-to-$RSYNC_LOGIN2 # must be done before first send +find $SLICE/2001/ -type f | grep -v '/\.' | xargs md5sum | sort > /tmp/test/1 +FULL=1 $base_dir/user-md5sum.pl u2001 | sort > /tmp/test/2 -mkdir -p .send/$RSYNC_LOGIN2/received -ln -s ../../../sent-to-$RSYNC_LOGIN2 .send/$RSYNC_LOGIN2/received/new-name +diff /tmp/test/1 /tmp/test/2 && echo "OK - md5 database consistant with filesystem" -push .send -rvl