From: Arjen Baart Date: Tue, 15 Sep 2020 05:46:41 +0000 (+0200) Subject: Test creating notifications X-Git-Url: http://www.andromeda.nl/gitweb/?p=gnucomo.git;a=commitdiff_plain;h=a85e804fd7f87a4d067ef31a634b54bd6106c0f5 Test creating notifications --- diff --git a/test/Makefile.am b/test/Makefile.am index 1f61670..bfa8e8d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,4 +1,5 @@ -TESTS = createdb upgradedb read_messages read_bad_messages read_apache_error read_without_hostname +TESTS = createdb upgradedb read_messages read_bad_messages read_apache_error read_without_hostname \ + notifications clean-local: rm -f gcm_input.log log.tbl diff --git a/test/notifications b/test/notifications new file mode 100755 index 0000000..915553f --- /dev/null +++ b/test/notifications @@ -0,0 +1,64 @@ +#!/bin/bash + +# +# Test the service and log 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 +# several notifications, three for each object. +# +# This tests problem report nr. 23 + +#LD_LIBRARY_PATH=/usr/local/pqxx/lib +#export LD_LIBRARY_PATH + + +rm -f gcm_input.log + +createdb gnucomo_test + +result=0 + +if psql gnucomo_test -q <../src/database/create.sql >/dev/null +then + # Prepare the database + + psql gnucomo_test -q -c "insert into object (objectname) values ('example1.gnucomo.test')" + psql gnucomo_test -q -c "insert into object (objectname) values ('example2.gnucomo.test')" + psql gnucomo_test -q -c "delete from service" + + # read logs for both objects + + ../src/gcm_input/gcm_input -c gnucomo_test -h example1.gnucomo.test -d 'sep 5 2002 20:30:45' /var/log/lsmod.log; /sbin/rmmod -as) | f | f - 3 | 1 | | kernel | 2002-09-01 04:11:07+02 | 2002-09-05 00:00:00+02 | Sep 1 04:11:07 kithira kernel: isdn_net: local hangup ippp0 | f | f - 4 | 1 | | kernel | 2002-09-01 04:11:07+02 | 2002-09-05 00:00:00+02 | Sep 1 04:11:07 kithira kernel: ippp0: Chargesum is 0 | f | f - 5 | 1 | | ipppd | 2002-09-01 04:11:07+02 | 2002-09-05 00:00:00+02 | Sep 1 04:11:07 kithira ipppd[1513]: Modem hangup | f | f - 6 | 1 | | ipppd | 2002-09-01 04:11:07+02 | 2002-09-05 00:00:00+02 | Sep 1 04:11:07 kithira ipppd[1513]: Connection terminated. | f | f - 7 | 1 | | ipppd | 2002-09-01 04:11:07+02 | 2002-09-05 00:00:00+02 | Sep 1 04:11:07 kithira ipppd[1513]: taking down PHASE_DEAD link 0, linkunit: 0 | f | f - 8 | 1 | | ipppd | 2002-09-01 04:11:07+02 | 2002-09-05 00:00:00+02 | Sep 1 04:11:07 kithira ipppd[1513]: closing fd 7 from unit 0 | f | f - 9 | 1 | | ipppd | 2002-09-01 04:11:07+02 | 2002-09-05 00:00:00+02 | Sep 1 04:11:07 kithira ipppd[1513]: link 0 closed , linkunit: 0 | f | f - 10 | 1 | | ipppd | 2002-09-01 04:11:07+02 | 2002-09-05 00:00:00+02 | Sep 1 04:11:07 kithira ipppd[1513]: reinit_unit: 0 | f | f - 11 | 1 | | ipppd | 2002-09-01 04:11:07+02 | 2002-09-05 00:00:00+02 | Sep 1 04:11:07 kithira ipppd[1513]: Connect[0]: /dev/ippp0, fd: 7 | f | f - 12 | 1 | | CROND | 2002-09-01 04:15:00+02 | 2002-09-05 00:00:00+02 | Sep 1 04:15:00 kithira CROND[17423]: (uucp) CMD (/usr/sbin/uucico -r1) | f | f - 13 | 1 | | CROND | 2002-09-01 04:20:00+02 | 2002-09-05 00:00:00+02 | Sep 1 04:20:00 kithira CROND[17581]: (root) CMD ( /sbin/lsmod >/var/log/lsmod.log; /sbin/rmmod -as) | f | f - 14 | 1 | | kernel | 2002-09-01 04:20:00+02 | 2002-09-05 00:00:00+02 | Sep 1 04:20:00 kithira kernel: solo1: unloading | f | f - 15 | 1 | | kernel | 2002-09-01 04:20:00+02 | 2002-09-05 00:00:00+02 | Sep 1 04:20:00 kithira kernel: Uniform CD-ROM driver unloaded | f | f - 16 | 1 | | kernel | 2002-09-01 04:20:01+02 | 2002-09-05 00:00:00+02 | Sep 1 04:20:01 kithira kernel: ide-floppy driver 0.99.newide | f | f - 17 | 1 | | kernel | 2002-09-01 04:20:02+02 | 2002-09-05 00:00:00+02 | Sep 1 04:20:02 kithira kernel: hdb: ATAPI 40X CD-ROM drive, 128kB Cache, DMA | f | f - 18 | 1 | | kernel | 2002-09-01 04:20:02+02 | 2002-09-05 00:00:00+02 | Sep 1 04:20:02 kithira kernel: Uniform CD-ROM driver Revision: 3.12 | f | f - 19 | 1 | | kernel | 2002-09-01 04:20:02+02 | 2002-09-05 00:00:00+02 | Sep 1 04:20:02 kithira kernel: Attached scsi CD-ROM sr0 at scsi0, channel 0, id 4, lun 0 | f | f - 20 | 1 | | kernel | 2002-09-01 04:20:02+02 | 2002-09-05 00:00:00+02 | Sep 1 04:20:02 kithira kernel: sr0: scsi3-mmc drive: 20x/20x writer cd/rw xa/form2 cdda tray | f | f - 21 | 1 | | CROND | 2002-09-01 04:22:00+02 | 2002-09-05 00:00:00+02 | Sep 1 04:22:00 kithira CROND[17587]: (root) CMD (run-parts /etc/cron.weekly) | f | f - 22 | 1 | | anacron | 2002-09-01 04:22:00+02 | 2002-09-05 00:00:00+02 | Sep 1 04:22:00 kithira anacron[17591]: Error opening /etc/anacrontab: No such file or directory | f | f - 23 | 1 | | anacron | 2002-09-01 04:22:00+02 | 2002-09-05 00:00:00+02 | Sep 1 04:22:00 kithira anacron[17591]: Aborted | f | f - 24 | 1 | | CROND | 2002-09-01 04:30:00+02 | 2002-09-05 00:00:00+02 | Sep 1 04:30:00 kithira CROND[27975]: (root) CMD ( /sbin/lsmod >/var/log/lsmod.log; /sbin/rmmod -as) | f | f - 25 | 1 | | su | 2002-09-01 04:30:51+02 | 2002-09-05 00:00:00+02 | Sep 1 04:30:51 kithira su(pam_unix)[27979]: session opened for user news by (uid=0) | f | f - 26 | 1 | | su | 2002-09-01 04:30:51+02 | 2002-09-05 00:00:00+02 | Sep 1 04:30:51 kithira su(pam_unix)[27979]: session closed for user news | f | f - 27 | 1 | | named | 2002-09-01 04:31:03+02 | 2002-09-05 00:00:00+02 | Sep 1 04:31:03 kithira named[996]: listening on IPv4 interface ippp0, 195.121.198.124#53 | f | f - 28 | 1 | | named | 2002-09-01 04:31:03+02 | 2002-09-05 00:00:00+02 | Sep 1 04:31:03 kithira named[996]: no longer listening on 195.121.198.217#53 | f | f -(28 rows) - diff --git a/test/t0005.sh b/test/t0005.sh deleted file mode 100644 index a0d34b6..0000000 --- a/test/t0005.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# -# Create an object 'kithira.andromeda.nl' in the database and -# parse a piece of a syslog file without specifying a time. -# This tests wether an improper time still creates valid data. - -cd .. - -if psql gnucomo_test -q /dev/null -then - psql gnucomo_test -q -c "insert into object (objectname) values ('kithira.andromeda.nl')" - psql gnucomo_test -c "select * from object" - src/gcm_input/gcm_input -c gnucomo_test -h kithira.andromeda.nl -d 'sep 5 2002' /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'