Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 1 | varnishtest "Check: smptchk option" |
| 2 | feature ignore_unknown_macro |
| 3 | |
Frédéric Lécaille | eacb022 | 2019-04-29 16:10:12 +0200 | [diff] [blame] | 4 | #EXCLUDE_TARGETS=freebsd,osx,generic |
Frédéric Lécaille | dc1a3bd | 2019-03-29 15:07:24 +0100 | [diff] [blame] | 5 | #REGTEST_TYPE=slow |
| 6 | |
Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 7 | barrier b cond 3 |
| 8 | |
| 9 | syslog S1 -level notice { |
| 10 | recv |
wrightlaw | d67b10f | 2022-09-08 16:10:48 +0100 | [diff] [blame] | 11 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 succeeded.+reason: Layer7 check passed.+code: 221.+check duration: [[:digit:]]+ms.+status: 1/1 UP." |
Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 12 | barrier b sync |
| 13 | recv |
Christopher Faulet | 617780f | 2020-04-07 08:00:35 +0200 | [diff] [blame] | 14 | expect ~ "Health check for server be1/srv1 failed.+reason: Layer7 timeout.+check duration: [[:digit:]]+ms.+status: 0/1 DOWN" |
Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 15 | } -start |
| 16 | |
| 17 | syslog S2 -level notice { |
| 18 | recv |
Christopher Faulet | a67ed43 | 2020-04-20 14:59:20 +0200 | [diff] [blame] | 19 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv2 succeeded.+reason: Layer7 check passed.+code: 200.+.+check duration: [[:digit:]]+ms.+status: 1/1 UP." |
Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 20 | barrier b sync |
| 21 | recv |
Christopher Faulet | 617780f | 2020-04-07 08:00:35 +0200 | [diff] [blame] | 22 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv2 failed.+reason: Layer7 timeout.+check duration: [[:digit:]]+ms.+status: 0/1 DOWN" |
Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 23 | } -start |
| 24 | |
| 25 | syslog S3 -level notice { |
| 26 | recv |
Christopher Faulet | 617780f | 2020-04-07 08:00:35 +0200 | [diff] [blame] | 27 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be3/srv3 failed.+reason: Layer4 connection problem.+info: \"General socket error \\(Network is unreachable\\)\".+check duration: [[:digit:]]+ms.+status: 0/1 DOWN." |
Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 28 | } -start |
| 29 | |
| 30 | syslog S4 -level notice { |
| 31 | recv |
Christopher Faulet | 617780f | 2020-04-07 08:00:35 +0200 | [diff] [blame] | 32 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be4/srv4 failed.+reason: Layer4 connection problem.+info: \"Connection refused\".+check duration: [[:digit:]]+ms.+status: 0/1 DOWN." |
Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 33 | } -start |
| 34 | |
| 35 | server s1 { |
Christopher Faulet | 617780f | 2020-04-07 08:00:35 +0200 | [diff] [blame] | 36 | send "2" |
| 37 | send "2" |
| 38 | send "0" |
Christopher Faulet | 25a4a42 | 2022-09-21 15:05:42 +0200 | [diff] [blame] | 39 | send "\r\n" |
Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 40 | recv 16 |
| 41 | send "2" |
| 42 | send "4" |
| 43 | send "8" |
Christopher Faulet | 25a4a42 | 2022-09-21 15:05:42 +0200 | [diff] [blame] | 44 | send "\r\n" |
wrightlaw | d67b10f | 2022-09-08 16:10:48 +0100 | [diff] [blame] | 45 | recv 6 |
| 46 | send "2" |
| 47 | send "2" |
| 48 | send "1" |
| 49 | send " ok\r\n" |
Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 50 | } -start |
| 51 | |
| 52 | server s2 { |
| 53 | rxreq |
| 54 | txresp |
| 55 | } -start |
| 56 | |
| 57 | haproxy h1 -conf { |
| 58 | defaults |
| 59 | timeout client 1s |
| 60 | timeout server 1s |
| 61 | timeout connect 1s |
| 62 | option log-health-checks |
Christopher Faulet | 617780f | 2020-04-07 08:00:35 +0200 | [diff] [blame] | 63 | default-server inter 200ms downinter 100ms rise 1 fall 1 |
Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 64 | |
| 65 | backend be1 |
| 66 | option smtpchk |
| 67 | log ${S1_addr}:${S1_port} daemon |
| 68 | server srv1 ${s1_addr}:${s1_port} check |
| 69 | |
| 70 | backend be2 |
| 71 | mode tcp |
| 72 | log ${S2_addr}:${S2_port} daemon |
| 73 | option httpchk OPTIONS * HTTP/1.1\r\nHost:\ www |
| 74 | server srv2 ${s2_addr}:${s2_port} check |
| 75 | |
| 76 | backend be3 |
| 77 | log ${S3_addr}:${S3_port} daemon |
| 78 | server srv3 255.255.255.255:11111 check |
| 79 | |
| 80 | backend be4 |
| 81 | log ${S4_addr}:${S4_port} daemon |
| 82 | server srv4 localhost:11111 check |
| 83 | } -start |
| 84 | |
| 85 | haproxy h1 -cli { |
| 86 | barrier b sync |
| 87 | send "show servers state" |
| 88 | expect ~ .* |
| 89 | } |
| 90 | |
| 91 | server s1 -wait |
| 92 | server s2 -wait |
| 93 | |
| 94 | syslog S1 -wait |
| 95 | syslog S2 -wait |
| 96 | syslog S3 -wait |
| 97 | syslog S4 -wait |
| 98 | |
| 99 | |