aboutsummaryrefslogtreecommitdiffstats
path: root/test/add.sh
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-11-19 19:11:06 +0200
committergramanas <anastasis.gramm2@gmail.com>2018-11-19 19:11:06 +0200
commit78ee1c72c670a71bfd165448676fc65bff802916 (patch)
tree893b0f09dfc84f3fd7f1ac218213012f33d5b612 /test/add.sh
parent84bbbb91c9154ca0b1c295eb7d1aa0de59450764 (diff)
downloadck-78ee1c72c670a71bfd165448676fc65bff802916.tar.gz
ck-78ee1c72c670a71bfd165448676fc65bff802916.tar.bz2
ck-78ee1c72c670a71bfd165448676fc65bff802916.zip
Add ability to use ck without secret dir
Diffstat (limited to 'test/add.sh')
-rw-r--r--test/add.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/add.sh b/test/add.sh
new file mode 100644
index 0000000..05cf13f
--- /dev/null
+++ b/test/add.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+init add
+
+# setup test configs
+echo "Test 1" > $BIN/test1.conf
+echo "Test 2" > $BIN/test2.conf
+echo "Test 3" > $BIN/test3.conf
+
+function run_add {
+ # add configs to ck
+ exec $BIN/ck -c $BIN add $1 $BIN/$2 $3 $4 >&${V} &
+ wait $!
+
+ if [ $? -ne 0 ]; then
+ err "ck crashed."
+ fi
+
+ # check db
+ if [ "$(sqlite3 $BIN/ckdb "select name from program where name = '$1'")" != "$1" ]; then
+ err "$1 is not in the db."
+ fi
+
+ if [ "$($BIN/ck -c $BIN ls -p $1)" != "$BIN/$2" ]; then
+ err "$2 is not in the db."
+ fi
+
+ # check files
+ FOLDER=vc
+ if [[ "$3" = "-s" || "$4" = "-s" ]]; then
+ FOLDER=sec
+ fi
+
+ if [ ! -f $TEST_LOCATION/$FOLDER/$1/$2 ]; then
+ err "$2 No move (add $3 $4)"
+ fi
+
+ if [ ! -L $BIN/$2 ]; then
+ err "$2 No symlink (add $3 $4)"
+ fi
+}
+
+run_add prog1 test1.conf -p
+run_add prog2 test2.conf -s
+run_add prog3 test3.conf -p -s
+
+clear_tests
+echo -e $PASS