better test non-existing md5sum directory
[cloudstore.git] / test.sh
1 #!/bin/sh -xe
2
3 user_dir=/srv/cloudstore/users/test/
4 rm -Rvf $user_dir/log/* $user_dir/blob/*
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
48 find . type -f | xargs -i md5sum {} > /tmp/md5sum
49
50 rm foo bar
51 push dir-test --recursive --delete -v
52 rm -Rf dir-test
53
54 pull non-existing || true
55
56 cp /tmp/md5sum md5sum
57 mkdir clone
58 # test md5 import from directory
59 mv md5sum clone/
60 push clone -r -v
61 # client should hardlink or copy files locally to avoid wastefull pull
62 # but we test server-side hardlink here
63 pull clone -r -v
64
65 md5sum clone/* | sed -e 's!  !  _import/foo/bar/baz!' > md5sum
66 cat md5sum
67 push md5sum -v
68
69 tail -20 $user_dir/log/*
70
71 #diff -urw $user_dir/blob $dir/
72 #diff -urw $user_dir/json $dir/
73
74 ls -al $user_dir/blob