port md5 support to TokyoCabinet
[cloudstore.git] / test.sh
diff --git a/test.sh b/test.sh
index 39918ce..707577f 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -1,33 +1,34 @@
 #!/bin/sh -xe
 
-user_dir=/srv/cloudstore/users/test/
-rm -Rvf $user_dir/log/* #$user_dir/blob/*
+RSYNC_LOGIN=fake
 
 push() {
        file=`shift`
-       RSYNC_PASSWORD=secret rsync $* $file rsync://test+localhost@127.0.0.1:6501/test/localhost/$file
+       RSYNC_PASSWORD=secret rsync $* $file rsync://$RSYNC_LOGIN@127.0.0.1:6501/$RSYNC_LOGIN/localhost/$file
 }
 pull() {
        from=$1
        to=$2
        test -z "$to" && to=$1
-       RSYNC_PASSWORD=secret rsync rsync://test+localhost@127.0.0.1:6501/test/localhost/$from $to
+       RSYNC_PASSWORD=secret rsync rsync://$RSYNC_LOGIN@127.0.0.1:6501/$RSYNC_LOGIN/localhost/$from $to
 }
 
 
-./remove-user.sh test
+sudo ./remove-user.sh test@example.com
+sudo ./remove-user.sh test2@example.com
 
-./create-user.sh test secret
-./create-user.sh test secret localhost
-
-./remove-user.sh test2
-./create-user.sh test2 secret
+RSYNC_LOGIN=`sudo ./create-user.sh test@example.com secret 500k`
+RSYNC_LOGIN2=`sudo ./create-user.sh test2@example.com secret 20k`
 
 dir=/tmp/test
 rm -Rf "$dir"
 mkdir /tmp/test
 cd $dir
+
 push . --recursive --delete -v
+
+if true ; then # skip tests if false
+
 ps ax > foo
 push foo -v
 push foo -v
@@ -69,17 +70,40 @@ md5sum clone/* | sed -e 's!  !  _import/foo/bar/baz!' > md5sum
 cat md5sum
 push md5sum -v
 
+# test unused md5 pool quota
+
+ps ax > tmp
+push tmp -v
+rm tmp
+push . -r --delete -v
+
 # test send
 
-ps ax >> sent-to-test2
-mkdir -p .send/test2/received
-ln -s ../../../sent-to-test2 .send/test2/received/
+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
+
 
-push .send -rvl
+fi # skip tests
 
-tail -20 $user_dir/log/*
+# test file move
 
-#diff -urw $user_dir/blob $dir/
-#diff -urw $user_dir/json $dir/
+pending=/tmp/pending.0610201109464117
+grep ^MOVED $pending | cut -d\# -f2 | xargs -i sh -c "ps ax > {}"
+push . -rv
 
-ls -al $user_dir/blob
+mkdir -p .sync/pending
+cp $pending .sync/pending/
+push .sync -rv