New test scripts
[gnucomo.git] / test / t0009.sh
diff --git a/test/t0009.sh b/test/t0009.sh
new file mode 100644 (file)
index 0000000..b13f9de
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+#
+#  Test the service check notifications.
+#  Create a database with two objects and no services. After reading two
+#  log file fragments for these two objects, gcm_daemon should create
+#  'service unknown' notifications, one for each object.
+#
+#  This tests problem report nr. 23
+
+LD_LIBRARY_PATH=/usr/local/pqxx/lib
+export LD_LIBRARY_PATH
+
+cd ..
+
+if psql gnucomo_test -f src/database/create.sql -q >/dev/null
+then
+   #  Prepare the database
+
+   psql gnucomo_test -q -c "insert into object (objectname) values ('kithira.andromeda.nl')"
+   psql gnucomo_test -q -c "insert into object (objectname) values ('vd.wt.tno.nl')"
+   psql gnucomo_test -q -c "delete from service"
+
+   #  read logs for both objects
+
+   src/gcm_input/gcm_input -c gnucomo_test -h vd.wt.tno.nl -d 'sep 5 2002 20:30:45' <test/vd.messages
+   src/gcm_input/gcm_input -c gnucomo_test -h kithira.andromeda.nl -d 'sep 5 2002 20:30:45' <test/messages
+
+   # Make the notifications.
+   src/gcm_daemon/gcm_daemon.php -c gnucomo_test
+
+   # Check the notifications.
+
+   psql gnucomo_test -c "select notificationid,objectid,type_of_issueid from notification"
+
+   #  Clean up.
+
+   psql gnucomo_test -f src/database/destroy.sql -q
+
+   exit 0
+else
+   echo Can not create test database
+   exit 1
+fi