9081a8e8cbcb91bad23312d22d7127893c690ab8
[cloudstore.git] / test.sh
1 #!/bin/sh -xe
2
3 user_dir=/srv/cloudstore/users/test/
4 rm -vf $user_dir/log/*
5
6 push() {
7         file=`shift`
8         RSYNC_PASSWORD=secret rsync $* $file rsync://test+localhost@127.0.0.1:6501/test/$file
9 }
10 pull() {
11         from=$1
12         to=$2
13         test -z "$to" && to=$1
14         RSYNC_PASSWORD=secret rsync rsync://test+localhost@127.0.0.1:6501/test/$from $to
15 }
16
17
18 ./remove-user.sh test
19
20 ./create-user.sh test secret
21 ./create-user.sh test secret localhost
22
23 dir=/tmp/test
24 rm -Rf "$dir"
25 mkdir /tmp/test
26 cd $dir
27 push . --recursive --delete -v
28 ps ax > foo
29 push foo -v
30 push foo -v
31 ps ax > bar
32 push bar -v
33 touch --date='2000-01-01' bar
34 push bar -v
35 pull bar baz
36 push baz -v
37 ps ax >> baz
38 push baz -v
39 cp baz baz2
40 push baz baz2 -v
41
42 mkdir dir-test
43 # deduplicate?
44 cp foo bar dir-test/
45 uptime > "dir-test/file with spaces"
46 push dir-test --recursive -v
47 rm foo bar
48 push dir-test --recursive --delete -v
49 rm -Rf dir-test
50
51 pull non-existing || true
52
53 tail -20 $user_dir/log/*
54
55 #diff -urw $user_dir/blob $dir/
56 #diff -urw $user_dir/json $dir/
57
58 ls -al $user_dir/blob $user_dir/json