use logins from create-user.sh
[cloudstore.git] / test.sh
diff --git a/test.sh b/test.sh
index 983558e..8b6504c 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -1,24 +1,27 @@
 #!/bin/sh -xe
 
 user_dir=/srv/cloudstore/users/test/
-rm -vf $user_dir/log/*
+rm -Rvf $user_dir/log/* #$user_dir/blob/*
+
+RSYNC_LOGIN=u2000
 
 push() {
        file=`shift`
-       RSYNC_PASSWORD=secret rsync $* $file rsync://test+localhost@127.0.0.1:6501/test/$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/$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
+RSYNC_LOGIN=`sudo ./create-user.sh test@example.com secret 200k`
+RSYNC_LOGIN2=`sudo ./create-user.sh test2@example.com secret 20k`
 
 dir=/tmp/test
 rm -Rf "$dir"
@@ -44,13 +47,16 @@ mkdir dir-test
 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
 
-md5sum * > md5sum
+cp /tmp/md5sum md5sum
 mkdir clone
 # test md5 import from directory
 mv md5sum clone/
@@ -59,9 +65,16 @@ push clone -r -v
 # but we test server-side hardlink here
 pull clone -r -v
 
-tail -20 $user_dir/log/*
+md5sum clone/* | sed -e 's!  !  _import/foo/bar/baz!' > md5sum
+cat md5sum
+push md5sum -v
+
+# test send
+
+ps ax >> sent-to-$RSYNC_LOGIN2
+push sent-to-$RSYNC_LOGIN2 # must be done before first send
 
-#diff -urw $user_dir/blob $dir/
-#diff -urw $user_dir/json $dir/
+mkdir -p .send/$RSYNC_LOGIN2/received
+ln -s ../../../sent-to-$RSYNC_LOGIN2 .send/$RSYNC_LOGIN2/received/new-name
 
-ls -al $user_dir/blob $user_dir/json
+push .send -rvl