summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2020-04-18 15:36:54 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2020-04-22 19:27:27 +0100
commit1950cf85b47f7c8407b3318a4f8fc57c0af6d6ba (patch)
tree205c52910616b408c0c110b3c187414cc8ca5db5 /test
parentaccf9211ea33262b8865805a4f61155f26320444 (diff)
readsocket expansion: response caching
Diffstat (limited to 'test')
-rw-r--r--test/confs/03732
-rw-r--r--test/log/03732
-rw-r--r--test/rejectlog/03732
-rw-r--r--test/scripts/0000-Basic/037349
-rw-r--r--test/stderr/22002
-rw-r--r--test/stderr/22012
-rw-r--r--test/stderr/26104
-rw-r--r--test/stderr/26204
-rw-r--r--test/stdout/037356
9 files changed, 92 insertions, 31 deletions
diff --git a/test/confs/0373 b/test/confs/0373
index 10d64b782..2909d7de0 100644
--- a/test/confs/0373
+++ b/test/confs/0373
@@ -10,6 +10,8 @@ domainlist local_domains = test.ex : *.test.ex
acl_smtp_connect = connect
trusted_users = CALLER
+log_selector = +millisec
+
# ----- ACL -----
diff --git a/test/log/0373 b/test/log/0373
index 7082f4d53..33bdb386f 100644
--- a/test/log/0373
+++ b/test/log/0373
@@ -1 +1 @@
-1999-03-02 09:44:33 H=[V4NET.0.0.0] U=CALLER temporarily rejected connection in "connect" ACL: failed to expand ACL string "${readsocket{TESTSUITE/test-socket}{QUERY-ACL\n}{2s}{*EOL*}}": socket read timed out
+2017-07-30 18:51:05.712 H=[V4NET.0.0.0] U=CALLER temporarily rejected connection in "connect" ACL: failed to expand ACL string "${readsocket{TESTSUITE/test-socket}{QUERY-ACL\n}{2s}{*EOL*}}": socket read timed out
diff --git a/test/rejectlog/0373 b/test/rejectlog/0373
index 7082f4d53..33bdb386f 100644
--- a/test/rejectlog/0373
+++ b/test/rejectlog/0373
@@ -1 +1 @@
-1999-03-02 09:44:33 H=[V4NET.0.0.0] U=CALLER temporarily rejected connection in "connect" ACL: failed to expand ACL string "${readsocket{TESTSUITE/test-socket}{QUERY-ACL\n}{2s}{*EOL*}}": socket read timed out
+2017-07-30 18:51:05.712 H=[V4NET.0.0.0] U=CALLER temporarily rejected connection in "connect" ACL: failed to expand ACL string "${readsocket{TESTSUITE/test-socket}{QUERY-ACL\n}{2s}{*EOL*}}": socket read timed out
diff --git a/test/scripts/0000-Basic/0373 b/test/scripts/0000-Basic/0373
index 0f63cee9b..5d8bbee88 100644
--- a/test/scripts/0000-Basic/0373
+++ b/test/scripts/0000-Basic/0373
@@ -2,6 +2,7 @@
need_ipv4
#
exim -be
+connfail cases (no server)
1 >>${readsocket{DIR/test-socket}{QUERY-1\n}}<<
2 ${if exists{DIR/test-socket}\
{>>${readsocket{DIR/test-socket}{QUERY-1\n}}<<}\
@@ -38,6 +39,7 @@ QUERY-9
****
millisleep 500
exim -be
+unix-socket cases
1 >>${readsocket{DIR/test-socket}{QUERY-1\n}}<<
2 >>${readsocket{DIR/test-socket}{QUERY-2\n}}<<
3 >>${readsocket{DIR/test-socket}{QUERY-3\n}{2s}{*EOL*}}<<
@@ -90,19 +92,44 @@ QUERY-10
****
millisleep 500
exim -be
-1 >>${readsocket{inet:thisloop:PORT_S}{QUERY-1\n}}<<
-2 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-2\n}}<<
-3 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-3\n}{2s}{*EOL*}}<<
-4 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-4\n}{2s}{*EOL*}{sock error}}<<
-5 >>${readsocket{inet:127.0.0.1:PORT_S}{}}<<
-6 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-6\n}}<<
-7 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-7\n}{1s}{}{sock error}}<<
-8 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-8\n}{1s}}<<
-9 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-9\n}{1s}{}{sock error}}<<
-10 >>${readsocket{inet:badloop:PORT_S}{QUERY-10\n}}<<
-11 >>${readsocket{inet:thisloop:PORT_S}{QUERY-11\n}{2s:shutdown=no}}<<
+ipv4 cases
+1 ANSWER-1 >>${readsocket{inet:thisloop:PORT_S}{QUERY-1\n}}<<
+2 ANSWER-2 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-2\n}}<<
+3 ANSWER-3*EOL* >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-3\n}{2s}{*EOL*}}<<
+4 ANSWER-4*EOL* >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-4\n}{2s}{*EOL*}{sock error}}<<
+5 ANSWER-5 >>${readsocket{inet:127.0.0.1:PORT_S}{}}<<
+6 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-6\n}}<<
+7 >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-7\n}{1s}{}{sock error}}<<
+8 read timed out >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-8\n}{1s}}<<
+9 sock error >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-9\n}{1s}{}{sock error}}<<
+10 ANSWER-10\\n >>${readsocket{inet:badloop:PORT_S}{QUERY-10\n}}<<
+11 ANSWER-11 >>${readsocket{inet:thisloop:PORT_S}{QUERY-11\n}{2s:shutdown=no}}<<
****
#
exim -be
crash-regression-check >>${readsocket{inet:127.0.0.1:PORT_N}{}{}}<<
****
+#
+# Caching of response value
+server DIR/test-socket 3
+QUERY-1
+>LF>ANSWER-1
+>*eof
+QUERY-2
+>LF>ANSWER-2
+>*eof
+QUERY-1
+>LF>ANSWER-1
+>*eof
+****
+millisleep 500
+exim -be
+caching of response value
+1 >>${readsocket{DIR/test-socket}{QUERY-1\n}{5s:cache=yes}}<<
+1+ >>${readsocket{DIR/test-socket}{QUERY-1\n}{5s:cache=yes}}<<
+2 >>${readsocket{DIR/test-socket}{QUERY-2\n}{5s:cache=yes}}<<
+2- >>${readsocket{DIR/test-socket2}{QUERY-2\n}{5s:cache=yes}{}{expected failure}}<<
+1- >>${readsocket{DIR/test-socket2}{QUERY-1\n}{5s:cache=yes}{}{expected failure}}<<
+1+ >>${readsocket{DIR/test-socket}{QUERY-1\n}{5s:cache=yes}}<<
+1- >>${readsocket{DIR/test-socket}{QUERY-1\n}{5s}}<<
+****
diff --git a/test/stderr/2200 b/test/stderr/2200
index c8320321a..ba50dffa7 100644
--- a/test/stderr/2200
+++ b/test/stderr/2200
@@ -43,7 +43,7 @@ search_tidyup called
LRU list:
internal_search_find: file="NULL"
type=dnsdb key="a=shorthost.test.ex" opts=NULL
- cached data found but either wrong opts or dated; database lookup required for a=shorthost.test.ex
+ cached data found but out-of-date; database lookup required for a=shorthost.test.ex
dnsdb key: shorthost.test.ex
lookup yielded: 127.0.0.1
LOG: MAIN
diff --git a/test/stderr/2201 b/test/stderr/2201
index fb618fc64..8f9d0b585 100644
--- a/test/stderr/2201
+++ b/test/stderr/2201
@@ -176,7 +176,7 @@ search_find: file="NULL"
LRU list:
internal_search_find: file="NULL"
type=dnsdb key="a=shorthost.test.ex" opts=NULL
-cached data found but either wrong opts or dated; database lookup required for a=shorthost.test.ex
+cached data found but out-of-date; database lookup required for a=shorthost.test.ex
dnsdb key: shorthost.test.ex
lookup yielded: 127.0.0.1
LOG: MAIN
diff --git a/test/stderr/2610 b/test/stderr/2610
index 951ddecff..b8eda8542 100644
--- a/test/stderr/2610
+++ b/test/stderr/2610
@@ -264,7 +264,7 @@ check set acl_m0 = ok: ${lookup mysql {select name from the
LRU list:
internal_search_find: file="NULL"
type=mysql key="select name from them where id = 'c'" opts="servers=127.0.0.1::1223/test/root/"
- cached data found but either wrong opts or dated; database lookup required for select name from them where id = 'c'
+ cached data found but wrong opts; database lookup required for select name from them where id = 'c'
MySQL query: "select name from them where id = 'c'" opts 'servers=127.0.0.1::1223/test/root/'
MYSQL using cached connection for 127.0.0.1:1223/test/root
MYSQL: no data found
@@ -278,7 +278,7 @@ check set acl_m0 = ok: ${lookup mysql,servers=127.0.0.1::1223/test/root/
LRU list:
internal_search_find: file="NULL"
type=mysql key="select name from them where id = 'c'" opts="servers=127.0.0.1::1223"
- cached data found but either wrong opts or dated; database lookup required for select name from them where id = 'c'
+ cached data found but wrong opts; database lookup required for select name from them where id = 'c'
MySQL query: "select name from them where id = 'c'" opts 'servers=127.0.0.1::1223'
MYSQL using cached connection for 127.0.0.1:1223/test/root
MYSQL: no data found
diff --git a/test/stderr/2620 b/test/stderr/2620
index 337d51850..2c378284b 100644
--- a/test/stderr/2620
+++ b/test/stderr/2620
@@ -254,7 +254,7 @@ check set acl_m0 = ok: ${lookup pgsql {select name from the
LRU list:
internal_search_find: file="NULL"
type=pgsql key="select name from them where id = 'c'" opts="servers=SSPEC"
- cached data found but either wrong opts or dated; database lookup required for select name from them where id = 'c'
+ cached data found but wrong opts; database lookup required for select name from them where id = 'c'
PostgreSQL query: "select name from them where id = 'c'" opts 'servers=SSPEC'
lookup deferred: PostgreSQL server "SSPEC" not found in pgsql_servers
warn: condition test deferred in ACL "check_recipient"
@@ -361,7 +361,7 @@ check set acl_m0 = ok: ${lookup pgsql {select name from the
LRU list:
internal_search_find: file="NULL"
type=pgsql key="select name from them where id = 'c'" opts="servers=SSPEC"
- cached data found but either wrong opts or dated; database lookup required for select name from them where id = 'c'
+ cached data found but wrong opts; database lookup required for select name from them where id = 'c'
PostgreSQL query: "select name from them where id = 'c'" opts 'servers=SSPEC'
lookup deferred: PostgreSQL server "SSPEC" not found in pgsql_servers
warn: condition test deferred in ACL "check_recipient"
diff --git a/test/stdout/0373 b/test/stdout/0373
index a4acc6591..513f36468 100644
--- a/test/stdout/0373
+++ b/test/stdout/0373
@@ -1,6 +1,8 @@
+> connfail cases (no server)
> Failed: failed to connect to socket TESTSUITE/test-socket: No such file or directory
> 2 ++ no socket ++
>
+> unix-socket cases
> 1 >>ANSWER-1
<<
> 2 >>ANSWER-2<<
@@ -13,22 +15,36 @@
> 9 >>sock error<<
>
451 Temporary local problem - please try later
-> 1 >>ANSWER-1
+> ipv4 cases
+> 1 ANSWER-1 >>ANSWER-1
<<
-> 2 >>ANSWER-2<<
-> 3 >>ANSWER-3*EOL*<<
-> 4 >>ANSWER-4*EOL*<<
-> 5 >>ANSWER-5<<
-> 6 >><<
-> 7 >><<
+> 2 ANSWER-2 >>ANSWER-2<<
+> 3 ANSWER-3*EOL* >>ANSWER-3*EOL*<<
+> 4 ANSWER-4*EOL* >>ANSWER-4*EOL*<<
+> 5 ANSWER-5 >>ANSWER-5<<
+> 6 >><<
+> 7 >><<
> Failed: socket read timed out
-> 9 >>sock error<<
-> 10 >>ANSWER-10
-<<
-> 11 >>ANSWER-11
+> 9 sock error >>sock error<<
+> 10 ANSWER-10\n >>ANSWER-10
<<
+> 11 ANSWER-11 >><<
>
-> Failed: bad time value NULL
+> Failed: failed to connect to any address for 127.0.0.1: Connection refused
+>
+> caching of response value
+> 1 >>ANSWER-1
+<<
+> 1+ >>ANSWER-1
+<<
+> 2 >>ANSWER-2
+<<
+> 2- >>expected failure<<
+> 1- >>expected failure<<
+> 1+ >>ANSWER-1
+<<
+> 1- >>ANSWER-1
+<<
>
******** SERVER ********
@@ -129,3 +145,19 @@ Connection request from [ip4.ip4.ip4.ip4]
>LF>ANSWER-11
>*eof
End of script
+Listening on TESTSUITE/test-socket ...
+Connection request
+QUERY-1
+>LF>ANSWER-1
+>*eof
+Listening on TESTSUITE/test-socket ...
+Connection request
+QUERY-2
+>LF>ANSWER-2
+>*eof
+Listening on TESTSUITE/test-socket ...
+Connection request
+QUERY-1
+>LF>ANSWER-1
+>*eof
+End of script