summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTobias Brox <tobias@redpill-linpro.com>2022-05-29 16:20:39 +0200
committerTobias Brox <tobias@redpill-linpro.com>2022-05-29 16:20:39 +0200
commitfd834cd17933bad5567f1315ddc800145081dcd6 (patch)
tree49692213cc5e9b408ee2cb75bd8b1f622d058746 /tests
parent36fbbe2654d2f73a7583d9538787fd807b781b0e (diff)
downloadcalendar-cli-fd834cd17933bad5567f1315ddc800145081dcd6.zip
some work on the testing script. (This should be cleaned up and made more readable and modular ... but how?)
Diffstat (limited to 'tests')
-rw-r--r--tests/_setup_alias1
-rwxr-xr-xtests/test_calendar-cli.sh19
-rwxr-xr-xtests/tests.sh24
3 files changed, 39 insertions, 5 deletions
diff --git a/tests/_setup_alias b/tests/_setup_alias
index bfa34f0..0f2c6de 100644
--- a/tests/_setup_alias
+++ b/tests/_setup_alias
@@ -1,3 +1,4 @@
+set -o pipefail
outfile=$(mktemp)
error() {
diff --git a/tests/test_calendar-cli.sh b/tests/test_calendar-cli.sh
index b3b3920..b45d596 100755
--- a/tests/test_calendar-cli.sh
+++ b/tests/test_calendar-cli.sh
@@ -2,6 +2,11 @@
storage=$(mktemp -d)
+echo "This script will attempt to set up a Radicale server and a Xandikos server and run the test code towards those two servers"
+echo "The test code itself is found in tests.sh"
+
+export RUNTESTSNOPAUSE="foo"
+
echo "########################################################################"
echo "## RADICALE"
echo "########################################################################"
@@ -21,11 +26,17 @@ then
## just get 404 when running tests.
export calendar_cli
export kal
- echo "press enter to run tests"
- read foo
+ if [ -n "$DEBUG" ]
+ then
+ echo "press enter to run tests"
+ read foo
+ fi
./tests.sh
- echo "press enter to take down test server"
- read foo
+ if [ -n "$DEBUG" ]
+ then
+ echo "press enter to take down test server"
+ read foo
+ fi
kill $radicale_pid
sleep 0.3
else
diff --git a/tests/tests.sh b/tests/tests.sh
index 1370578..bd1fbfb 100755
--- a/tests/tests.sh
+++ b/tests/tests.sh
@@ -12,7 +12,28 @@ do
[ -f $setup ] && source $setup
done
-echo "## CLEANUP from earlier failed test runs"
+if [ -z "$RUNTESTSNOPAUSE" ]
+then
+ echo "tests.sh"
+ echo
+ echo "Generally, tests.sh should only be run directly if you know what you are doing"
+ echo "You may want to use test_calendar-cli.sh instead"
+ echo
+ echo "This script will use the following commands to access a calendar server:"
+ echo
+ echo "$calendar_cli"
+ echo "$kal"
+ echo
+ echo "This may work if you have configured a calendar server."
+ echo "The tests will add and delete events and tasks."
+ echo "Content from 2010-10 may be deleted"
+ echo
+ echo "Press enter or ctrl-C"
+ read foo
+fi
+
+
+echo "## CLEANUP from earlier failed test runs, if any"
QUIET=true
for uid in $($calendar_cli calendar agenda --from-time=2010-10-09 --agenda-days=5 --event-template='{uid}') ; do calendar_cli calendar delete --event-uid=$uid ; done
@@ -55,6 +76,7 @@ echo $output | { grep -q $uid2 && echo "## OK: found the UID" ; } || error "didn
echo "## Deleting events with uid $uid $uid1 $uid2"
calendar_cli calendar delete --event-uid=$uid
calendar_cli calendar delete --event-uid=$uid2
+calendar_cli calendar delete --event-uid=$uid3
kal select --uid=$uid3 delete
echo "## Searching again for the deleted event"
calendar_cli calendar agenda --from-time=2010-10-10 --agenda-days=3