rsyslog/tests/pgsql-template-cnf6.sh
Dan Molik f334e2b250 ompgsql plugin - update postgres module
The PostgreSQL output module was woefully out-of-date the following
list is changes made to update the module to current Rsyslog standards.

  - allow for v6 configuration syntax
  - configurable ports
  - support transactional interface
  - push db connection into workers (libpq is threadsafe)
  - enable module testing on travis
  - ensure configuration syntax backwards compatibility
  - formatting around postgres core templating
  - use new test conventions
  - add new configuration syntax test
  - add valgrind tests for new and old syntax
  - add threading tests
  - add action queue long running tests
  - add action queue valgrind test
2017-12-09 09:04:46 -05:00

37 lines
1014 B
Bash
Executable File

#!/bin/bash
# This file is part of the rsyslog project, released under GPLv3
. $srcdir/diag.sh init
psql -h localhost -U postgres -f testsuites/pgsql-basic.sql
. $srcdir/diag.sh generate-conf
. $srcdir/diag.sh add-conf '
template(name="pgtemplate" type="list" option.sql="on") {
constant(value="INSERT INTO SystemEvents (SysLogTag) values ('"'"'")
property(name="msg")
constant(value="'"'"')")
}
module(load="../plugins/ompgsql/.libs/ompgsql")
if $msg contains "msgnum" then {
action(type="ompgsql" server="127.0.0.1"
db="syslogtest" user="postgres" pass="testbench"
template="pgtemplate")
}'
. $srcdir/diag.sh startup
. $srcdir/diag.sh injectmsg 0 5000
. $srcdir/diag.sh shutdown-when-empty
. $srcdir/diag.sh wait-shutdown
psql -h localhost -U postgres -d syslogtest -f testsuites/pgsql-select-syslogtag.sql -t -A > rsyslog.out.log
. $srcdir/diag.sh seq-check 0 4999
echo cleaning up test database
psql -h localhost -U postgres -c 'DROP DATABASE IF EXISTS syslogtest;'
. $srcdir/diag.sh exit