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 |
| 4 | |
| 5 | feature ignore_unknown_macro |
| 6 | |
| 7 | server s1 { |
| 8 | rxreq |
| 9 | txresp |
| 10 | } -start |
| 11 | |
| 12 | haproxy h1 -conf { |
| 13 | global |
| 14 | lua-load ${testdir}/k_healthcheckmail.lua |
| 15 | defaults |
| 16 | frontend femail |
| 17 | mode tcp |
| 18 | bind "fd@${femail}" |
| 19 | tcp-request content use-service lua.mailservice |
| 20 | |
| 21 | frontend luahttpservice |
| 22 | mode http |
| 23 | bind "fd@${luahttpservice}" |
| 24 | http-request use-service lua.luahttpservice |
| 25 | |
| 26 | frontend fe1 |
| 27 | mode http |
| 28 | bind "fd@${fe1}" |
| 29 | default_backend b1 |
| 30 | |
| 31 | http-response lua.bug |
| 32 | |
| 33 | backend b1 |
| 34 | mode http |
| 35 | option httpchk /svr_healthcheck |
| 36 | option log-health-checks |
| 37 | |
| 38 | email-alert mailers mymailers |
| 39 | email-alert level info |
| 40 | email-alert from from@domain.tld |
| 41 | email-alert to to@domain.tld |
| 42 | |
| 43 | server broken 127.0.0.1:65535 check |
| 44 | server srv_lua ${h1_luahttpservice_addr}:${h1_luahttpservice_port} check inter 500 |
| 45 | server srv1 ${s1_addr}:${s1_port} check inter 500 |
| 46 | |
| 47 | mailers mymailers |
| 48 | # timeout mail 20s |
| 49 | # timeout mail 200ms |
| 50 | mailer smtp1 ${h1_femail_addr}:${h1_femail_port} |
| 51 | |
| 52 | } -start |
| 53 | |
| 54 | # configure port for lua to call feluaservice |
| 55 | client c1 -connect ${h1_luahttpservice_sock} { |
| 56 | timeout 2 |
| 57 | txreq -url "/setport" -hdr "vtcport1: ${h1_femail_port}" |
| 58 | rxresp |
| 59 | expect resp.status == 200 |
| 60 | expect resp.body == "OK" |
| 61 | } -run |
| 62 | |
| 63 | delay 2 |
| 64 | server s2 -repeat 5 -start |
| 65 | delay 5 |
| 66 | |
| 67 | client c2 -connect ${h1_luahttpservice_sock} { |
| 68 | timeout 2 |
| 69 | txreq -url "/checkMailCounters" |
| 70 | rxresp |
| 71 | expect resp.status == 200 |
| 72 | expect resp.body == "MailCounters" |
| 73 | expect resp.http.mailsreceived == 16 |
| 74 | expect resp.http.mailconnectionsmade == 16 |
| 75 | } -run |