blob: ce3335f9b87692e7708da54f3cab10a050f8b358 [file] [log] [blame]
PiBa-NLc3949d42018-12-23 21:06:31 +01001varnishtest "Lua: txn:get_priv() scope"
2#REQUIRE_OPTIONS=LUA
3#REQUIRE_VERSION=1.6
Frédéric Lécailledc1a3bd2019-03-29 15:07:24 +01004#REGTEST_TYPE=broken
PiBa-NLc3949d42018-12-23 21:06:31 +01005
6feature ignore_unknown_macro
7
8server s1 {
9 rxreq
10 txresp
11} -start
12
13haproxy h1 -conf {
14 global
Frédéric Lécailleb894f922019-03-29 16:13:48 +010015 lua-load ${testdir}/healthcheckmail.lua
PiBa-NLc3949d42018-12-23 21:06:31 +010016defaults
17 frontend femail
18 mode tcp
19 bind "fd@${femail}"
20 tcp-request content use-service lua.mailservice
21
22 frontend luahttpservice
23 mode http
24 bind "fd@${luahttpservice}"
25 http-request use-service lua.luahttpservice
26
27 frontend fe1
28 mode http
29 bind "fd@${fe1}"
30 default_backend b1
31
32 http-response lua.bug
33
34 backend b1
35 mode http
36 option httpchk /svr_healthcheck
37 option log-health-checks
38
39 email-alert mailers mymailers
40 email-alert level info
41 email-alert from from@domain.tld
42 email-alert to to@domain.tld
43
44 server broken 127.0.0.1:65535 check
45 server srv_lua ${h1_luahttpservice_addr}:${h1_luahttpservice_port} check inter 500
46 server srv1 ${s1_addr}:${s1_port} check inter 500
47
48 mailers mymailers
49# timeout mail 20s
50# timeout mail 200ms
51 mailer smtp1 ${h1_femail_addr}:${h1_femail_port}
52
53} -start
54
55# configure port for lua to call feluaservice
56client c1 -connect ${h1_luahttpservice_sock} {
57 timeout 2
58 txreq -url "/setport" -hdr "vtcport1: ${h1_femail_port}"
59 rxresp
60 expect resp.status == 200
61 expect resp.body == "OK"
62} -run
63
64delay 2
65server s2 -repeat 5 -start
66delay 5
67
68client c2 -connect ${h1_luahttpservice_sock} {
69 timeout 2
70 txreq -url "/checkMailCounters"
71 rxresp
72 expect resp.status == 200
73 expect resp.body == "MailCounters"
74 expect resp.http.mailsreceived == 16
75 expect resp.http.mailconnectionsmade == 16
76} -run