aboutsummaryrefslogtreecommitdiffstats
path: root/test/delete.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/delete.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/delete.sh')
-rw-r--r--test/delete.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/delete.sh b/test/delete.sh
new file mode 100644
index 0000000..7e31d66
--- /dev/null
+++ b/test/delete.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+init delete
+
+# setup test configs
+path1=$BIN/test1.conf
+path2=$BIN/test2.conf
+path3=$BIN/test3.conf
+path4=$BIN/test4.conf
+
+add_config prog1 $path1
+add_config prog1 $path2
+
+add_config prog2 $path3
+add_config prog2 $path4
+
+# delete path1
+exec $BIN/ck -c $BIN del prog1 `basename $path1` >&${V} &
+wait $!
+
+for i in $($BIN/ck -c $BIN list paths); do
+ if [[ "$i" == "$path1" ]]; then
+ err "Couldn't delete path."
+ exit 1
+ fi
+done
+
+# delete path2 (also prog1)
+exec $BIN/ck -c $BIN del prog1 `basename $path2` >&${V} &
+wait $!
+
+for i in $($BIN/ck -c $BIN list programs); do
+ if [[ "$i" == "prog1" ]]; then
+ err "Removing all configs should delete the correspondig program."
+ fi
+done
+
+# delete prog2
+exec $BIN/ck -c $BIN del prog2 >&${V} &
+wait $!
+
+for i in $($BIN/ck -c $BIN list paths); do
+ if [[ "$i" == "$path3" ]] || [[ "$i" == "$path4" ]]; then
+ err "Removing the program should delete all it's configs."
+ fi
+done
+
+for i in $($BIN/ck -c $BIN list programs); do
+ if [[ "$i" == "prog1" ]]; then
+ err "Couldn't remove program."
+ fi
+done
+
+clear_tests
+echo -e $PASS