PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 1 | varnishtest "Lua: txn:get_priv() scope" |
| 2 | #REQUIRE_OPTIONS=LUA |
| 3 | #REQUIRE_VERSION=1.6 |
Frédéric Lécaille | dc1a3bd | 2019-03-29 15:07:24 +0100 | [diff] [blame] | 4 | #REGTEST_TYPE=broken |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 5 | |
| 6 | feature ignore_unknown_macro |
| 7 | |
| 8 | server s1 { |
| 9 | rxreq |
| 10 | txresp |
| 11 | } -start |
| 12 | |
| 13 | haproxy h1 -conf { |
| 14 | global |
Frédéric Lécaille | b894f92 | 2019-03-29 16:13:48 +0100 | [diff] [blame] | 15 | lua-load ${testdir}/healthcheckmail.lua |
PiBa-NL | c3949d4 | 2018-12-23 21:06:31 +0100 | [diff] [blame] | 16 | defaults |
| 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 |
| 56 | client 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 | |
| 64 | delay 2 |
| 65 | server s2 -repeat 5 -start |
| 66 | delay 5 |
| 67 | |
| 68 | client 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 |