REGTESTS: healthcheckmail: Update the test to be functionnal again

This reg-test is broken since a while. It was simplified to be
functionnal. Now, it only test email alerts.
diff --git a/reg-tests/mailers/healthcheckmail.vtc b/reg-tests/mailers/healthcheckmail.vtc
index 7532508..92b0967 100644
--- a/reg-tests/mailers/healthcheckmail.vtc
+++ b/reg-tests/mailers/healthcheckmail.vtc
@@ -1,75 +1,59 @@
-varnishtest "Lua: txn:get_priv() scope"
+varnishtest "Check health-check email alerts"
 #REQUIRE_OPTIONS=LUA
-#REGTEST_TYPE=broken
 
 feature ignore_unknown_macro
 
-server s1 {
-    rxreq
-    txresp
+syslog S1 -level notice {
+    recv
+    expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 failed.+reason: Socket error.+info: \"Connection reset by peer\".+check duration: [[:digit:]]+ms.+status: 0/1 DOWN."
+    recv info
+    expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Result=SUCCESS Bytes=[[:digit:]]+"
 } -start
 
 haproxy h1 -conf {
     global
         lua-load ${testdir}/healthcheckmail.lua
-defaults
-    frontend femail
+
+    defaults
+        timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+        timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+        timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+
+    listen lisrv
         mode tcp
-        bind "fd@${femail}"
-        tcp-request content use-service lua.mailservice
+        bind "fd@${lisrv}"
+        tcp-request connection reject
 
-    frontend luahttpservice
-        mode http
-        bind "fd@${luahttpservice}"
-        http-request use-service lua.luahttpservice
+    listen lismtp
+        mode tcp
+        bind "fd@${lismtp}"
+        log ${S1_addr}:${S1_port} daemon
+        log-format "Result=%[var(txn.result)] Bytes=%B"
+        tcp-request content use-service lua.mailservice
 
     frontend fe1
         mode http
         bind "fd@${fe1}"
-        default_backend b1
+        default_backend be1
 
-        http-response lua.bug
-
-    backend b1
+    backend be1
         mode http
-        option httpchk /svr_healthcheck
+        log ${S1_addr}:${S1_port} daemon
+        option httpchk
         option log-health-checks
 
+        default-server inter 200ms downinter 100ms rise 1 fall 1
+
         email-alert mailers mymailers
         email-alert level info
         email-alert from from@domain.tld
         email-alert to to@domain.tld
 
-        server broken 127.0.0.1:65535 check
-        server srv_lua ${h1_luahttpservice_addr}:${h1_luahttpservice_port} check inter 500
-        server srv1 ${s1_addr}:${s1_port} check inter 500
+        server srv1 ${h1_lisrv_addr}:${h1_lisrv_port} check
 
     mailers mymailers
-#      timeout mail 20s
-#      timeout mail 200ms
-      mailer smtp1 ${h1_femail_addr}:${h1_femail_port}
+        mailer smtp1 ${h1_lismtp_addr}:${h1_lismtp_port}
 
 } -start
 
-# configure port for lua to call feluaservice
-client c1 -connect ${h1_luahttpservice_sock} {
-    timeout 2
-    txreq -url "/setport" -hdr "vtcport1: ${h1_femail_port}"
-    rxresp
-    expect resp.status == 200
-    expect resp.body == "OK"
-} -run
-
-delay 2
-server s2 -repeat 5 -start
-delay 5
-
-client c2 -connect ${h1_luahttpservice_sock} {
-    timeout 2
-    txreq -url "/checkMailCounters"
-    rxresp
-    expect resp.status == 200
-    expect resp.body == "MailCounters"
-    expect resp.http.mailsreceived == 16
-    expect resp.http.mailconnectionsmade == 16
-} -run
+syslog S1 -wait