Testsuite: shift pgsql tests to the standard-run set
[exim.git] / test / scripts / 2620-Postgresql / 2620
CommitLineData
de1294ea
JH
1# pgsql lookups
2#
3# first, populate a DB to test against
4sudo rm -fr DIR/pgsql
5perl
6system 'initdb -D DIR/pgsql/data';
7****
8background
9/usr/bin/postgres -D DIR/pgsql/data -p PORT_N -k DIR/pgsql
10****
11perl
12system 'createdb -h localhost -p PORT_N test';
13system 'psql -h localhost -p PORT_N -d test \
14 -c "CREATE TABLE them ( name text, id text );" \
15 -c "INSERT INTO them VALUES ( \'Philip Hazel\', \'ph10\' );" \
16 -c "INSERT INTO them VALUES ( \'\', \'nothing\' );" \
17 -c "INSERT INTO them VALUES ( \'\"stquot\', \'quote2\' );" \
18 -c "INSERT INTO them VALUES ( \'before\' || CHR(13) || CHR(10) || \'after\', \'newline\' );" \
19 -c "INSERT INTO them VALUES ( \'x\' || CHR(9) || \'x\', \'tab\' );" \
20 -c "INSERT INTO them VALUES ( CHR(39) || \'stquot\', \'quote1\' );" \
21 ';
22****
23#
24# now, the tests
59371ea7
PH
25exim -d-all+lookup -be
26${lookup pgsql {select name from them where id='ph10';}}
27${lookup pgsql {select name from them where id='ph10';}}
28${lookup pgsql {select name from them where id='xxxx';}}
29${lookup pgsql {select name from them where id='nothing';}}
30${lookup pgsql {select id,name from them where id='nothing';}}
31${lookup pgsql {delete from them where id='nonexist';}}
32${lookup pgsql {select * from them where id='quote2';}}
33${lookup pgsql {select * from them where id='newline';}}
34${lookup pgsql {select * from them where id='tab';}}
5547e2c5 35${lookup pgsql {select * from them where name='${quote_pgsql:'stquot}';}}
b7670459 36${lookup pgsql {servers=x:localhost; select name from them where id='ph10';}}
de1294ea
JH
37${lookup pgsql {servers=localhost::PORT_N:x; select name from them where id='ph10';}}
38${lookup pgsql {servers=localhost::PORT_N/test/CALLER/:x; select name from them where id='ph10';}}
39${lookup pgsql {servers=(DIR/pgsql/.s.PGSQL.PORT_N)/test/CALLER/:x; select name from them where id='ph10';}}
59371ea7
PH
40****
41exim -d -bh 10.0.0.0
42mail from:<a@b>
43rcpt to:<c@d>
44rcpt to:<c@d>
45quit
46****
47exim -odi -d CALLER
48Test message
49.
50****
de1294ea
JH
51exim -DSERVERS=\(DIR/pgsql/.s.PGSQL.PORT_N\)/test/CALLER/ -d-all+lookup -be
52${lookup pgsql {select name from them where id='ph10';}}
53****
54#
55perl
56system 'pg_ctl stop -D DIR/pgsql/data -m immediate';
59371ea7 57****
de1294ea
JH
58killdaemon
59sudo rm -fr DIR/pgsql