From 46421fedf6fe291bfcb63482f3bfa9bb2c7fdff6 Mon Sep 17 00:00:00 2001 From: gramanas Date: Tue, 23 Oct 2018 17:42:28 +0300 Subject: Remove site clutter and rename test folder (tests -> test) --- test/03_delete | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 test/03_delete (limited to 'test/03_delete') diff --git a/test/03_delete b/test/03_delete new file mode 100644 index 0000000..1668576 --- /dev/null +++ b/test/03_delete @@ -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 -c $path1 > /dev/null & +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 -c $path2 > /dev/null & +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 > /dev/null & +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 -- cgit v1.2.3