aboutsummaryrefslogtreecommitdiffstats
path: root/jsaccess
diff options
context:
space:
mode:
Diffstat (limited to 'jsaccess')
-rwxr-xr-xjsaccess/store.sh13
-rw-r--r--jsaccess/tests/Makefile6
-rwxr-xr-xjsaccess/tests/test_store.sh68
-rwxr-xr-xjsaccess/tests/test_store_local.sh39
4 files changed, 75 insertions, 51 deletions
diff --git a/jsaccess/store.sh b/jsaccess/store.sh
index 2b6a2c4..a75b220 100755
--- a/jsaccess/store.sh
+++ b/jsaccess/store.sh
@@ -34,7 +34,6 @@ usage_exit() {
echo
echo "actions to deploy local store to remote:"
echo " push [store]"
- echo " pull [store]"
echo " rset <rsync_uri> [store]"
echo " rget [store]"
echo
@@ -218,12 +217,7 @@ action_rget() {
action_push() {
_rget
- rsync -avzP $store $rsync_uri
-}
-
-action_pull() {
- _rget
- rsync -avzP $rsync_uri $store
+ rsync -avzP $store/* $rsync_uri
}
# Check for dependencies
@@ -275,11 +269,6 @@ push)
_store_get $2
action_push
;;
-pull)
- [ $# -ne 1 -a $# -ne 2 ] && usage_exit
- _store_get $2
- action_pull
- ;;
rset)
[ $# -ne 2 -a $# -ne 3 ] && usage_exit
_store_get $3
diff --git a/jsaccess/tests/Makefile b/jsaccess/tests/Makefile
new file mode 100644
index 0000000..b282017
--- /dev/null
+++ b/jsaccess/tests/Makefile
@@ -0,0 +1,6 @@
+all:
+ rm -rf store/
+ rm -rf clone_store/
+ ./test_store.sh
+ @echo
+ @echo "ALL TESTS OK"
diff --git a/jsaccess/tests/test_store.sh b/jsaccess/tests/test_store.sh
new file mode 100755
index 0000000..c22ce26
--- /dev/null
+++ b/jsaccess/tests/test_store.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+# Unittests for jsaccess store.sh
+
+storesh=../store.sh
+TMP=test_store.tmp
+export JSA_PASS=jsa_unittest_passphrase
+export JSA_FORCE=1
+
+echo
+echo "=== INIT ==="
+
+$storesh init store ||exit 1
+[ -d store ] ||exit 2
+
+echo
+echo "=== LOCAL ==="
+
+$storesh add example.txt ||exit 10
+[ -d ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 11
+[ -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 12
+
+$storesh ls > $TMP ||exit 20
+[ `grep -c "example.txt" $TMP` -eq 1 ] || exit 21
+rm $TMP
+
+$storesh rm example.txt ||exit 30
+[ ! -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 31
+
+$storesh ls > $TMP ||exit 40
+[ `grep -c "example.txt" $TMP` -eq 0 ] || exit 41
+rm $TMP
+
+$storesh add example.txt ||exit 50
+[ -d ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 51
+[ -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 52
+
+$storesh rmall ||exit 60
+[ ! -d ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 61
+
+$storesh add example.txt ||exit 70
+[ -d ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 71
+[ -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 72
+
+echo
+echo "=== DEPLOY ==="
+
+$storesh rset clone_store ||exit 100
+echo clone_store |diff -u - ./store/.rsync_uri ||exit 101
+
+$storesh rget > $TMP ||exit 110
+[ `grep -c "rsync_uri: clone_store" $TMP` -eq 1 ] || exit 21
+
+$storesh push ||exit 120
+[ -f ./clone_store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 121
+
+echo
+echo "=== WIPE ==="
+
+$storesh wipe store ||exit 200
+[ ! -d store ] ||exit 201
+
+rm -rf ./clone_store/
+rm $TMP
+
+echo
+echo TEST OK
+exit 0
diff --git a/jsaccess/tests/test_store_local.sh b/jsaccess/tests/test_store_local.sh
deleted file mode 100755
index 0cec47a..0000000
--- a/jsaccess/tests/test_store_local.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-# Unittests for jsaccess store.sh
-
-storesh=../store.sh
-TMP=tmp
-export JSA_PASS=jsa_unittest_passphrase
-export JSA_FORCE=1
-
-$storesh init store ||exit 1
-[ -d store ] ||exit 2
-
-$storesh add example.txt ||exit 10
-[ -d /home/user/code/laurent-tools/jsaccess/tests/store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 11
-[ -f /home/user/code/laurent-tools/jsaccess/tests/store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 12
-
-$storesh ls > $TMP ||exit 20
-[ `grep -c "example.txt" $TMP` -eq 1 ] || exit 21
-rm $TMP
-
-$storesh rm example.txt ||exit 30
-[ ! -f /home/user/code/laurent-tools/jsaccess/tests/store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 31
-
-$storesh ls > $TMP ||exit 40
-[ `grep -c "example.txt" $TMP` -eq 0 ] || exit 41
-rm $TMP
-
-$storesh add example.txt ||exit 50
-[ -d /home/user/code/laurent-tools/jsaccess/tests/store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 51
-[ -f /home/user/code/laurent-tools/jsaccess/tests/store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 52
-
-$storesh rmall ||exit 60
-[ ! -d /home/user/code/laurent-tools/jsaccess/tests/store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 61
-
-$storesh wipe store ||exit 70
-[ ! -d store ] ||exit 71
-
-echo TEST OK
-exit 0