aboutsummaryrefslogtreecommitdiffstats
path: root/tests/03_delete
diff options
context:
space:
mode:
authorAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-10-07 14:10:52 +0300
committerAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-10-07 14:10:52 +0300
commitd202883e6d642ba5a973996654cfed674420da22 (patch)
tree498b07bbba9d16a76cf06d84e45929540222dc87 /tests/03_delete
parenta0db476bed7d7b814c426d23b55a74d585a6d8cb (diff)
downloadck-d202883e6d642ba5a973996654cfed674420da22.tar.gz
ck-d202883e6d642ba5a973996654cfed674420da22.tar.bz2
ck-d202883e6d642ba5a973996654cfed674420da22.zip
Update regression tests
Diffstat (limited to 'tests/03_delete')
-rw-r--r--tests/03_delete58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/03_delete b/tests/03_delete
new file mode 100644
index 0000000..6cc0dbc
--- /dev/null
+++ b/tests/03_delete
@@ -0,0 +1,58 @@
+#!/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 conf $BIN del -c $path1 > /dev/null &
+wait $!
+
+for i in $($BIN/ck conf $BIN list paths); do
+ if [[ "$i" == "$path1" ]]; then
+ echo -e $ERROR" Couldn't delete path."
+ exit 1
+ fi
+done
+
+# delete path2 (also prog1)
+exec $BIN/ck conf $BIN del -c $path2 > /dev/null &
+wait $!
+
+for i in $($BIN/ck conf $BIN list programs); do
+ if [[ "$i" == "prog1" ]]; then
+ echo -e $ERROR" Removing all configs should delete the correspondig program."
+ exit 1
+ fi
+done
+
+# delete prog2
+exec $BIN/ck conf $BIN del prog2 > /dev/null &
+wait $!
+
+for i in $($BIN/ck conf $BIN list paths); do
+ if [[ "$i" == "$path3" ]] || [[ "$i" == "$path4" ]]; then
+ echo -e $ERROR" Removing the program should delete all it's configs."
+ exit 1
+ fi
+done
+
+for i in $($BIN/ck conf $BIN list programs); do
+ if [[ "$i" == "prog1" ]]; then
+ echo -e $ERROR" Couldn't remove program."
+ exit 1
+ fi
+done
+
+clear_tests
+echo -e $PASS