aboutsummaryrefslogtreecommitdiffstats
path: root/jsaccess/tests/test_store.sh
blob: 653c6e858d2875e2f1a5be133f56b935d47f7742 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh

# Unittests for jsaccess jstore.sh

jstoresh=../jstore.sh
TMP=test_store.tmp
export JSA_PASS=jsa_unittest_passphrase
export JSA_FORCE=1

echo
echo "=== INIT ==="

$jstoresh init store ||exit 1
[ -d store ] ||exit 2

echo
echo "=== LOCAL ==="

$jstoresh add example.txt ||exit 10
[ -d ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 11
[ -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 12
$jstoresh ls > $TMP ||exit 20
[ `grep -c "example.txt" $TMP` -eq 1 ] || exit 21
rm $TMP
$jstoresh rm example.txt ||exit 30
[ ! -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 31
$jstoresh ls > $TMP ||exit 40
[ `grep -c "example.txt" $TMP` -eq 0 ] || exit 41
rm $TMP

$jstoresh add example.txt ||exit 50
[ -d ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 51
[ -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 52
$jstoresh rmall ||exit 60
[ ! -d ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 61

$jstoresh add-nocrypt example.txt ||exit 70
[ -d ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 71
[ -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/example.txt ] ||exit 72
$jstoresh rm example.txt ||exit 80
[ ! -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/example.txt ] ||exit 81
$jstoresh ls > $TMP ||exit 90
[ `grep -c "example.txt" $TMP` -eq 0 ] || exit 91
rm $TMP

$jstoresh add example.txt ||exit 95
[ -d ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 96
[ -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 97

echo
echo "=== DEPLOY ==="

$jstoresh rset store_push ||exit 100
echo store_push |diff -u - ./store/.rsync_uri ||exit 101

$jstoresh rget > $TMP ||exit 110
[ `grep -c "rsync_uri: store_push" $TMP` -eq 1 ] || exit 21

$jstoresh push ||exit 120
[ -f ./store_push/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 121

$jstoresh clone store/ store_clone ||exit 130
[ -f ./store_clone/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 131

echo
echo "=== WIPE ==="

$jstoresh wipe store ||exit 200
[ ! -d store ] ||exit 201

rm -rf ./store_clone/ ./store_push/
rm $TMP

echo
echo TEST OK
exit 0