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 |
| 11 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy be1 started" |
| 12 | recv |
Christopher Faulet | 617780f | 2020-04-07 08:00:35 +0200 | [diff] [blame] | 13 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 succeeded.+reason: Layer7 check passed.+code: 2(20|48).+check duration: [[:digit:]]+ms.+status: 1/1 UP." |
Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 14 | barrier b sync |
| 15 | recv |
Christopher Faulet | 617780f | 2020-04-07 08:00:35 +0200 | [diff] [blame] | 16 | 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] | 17 | } -start |
| 18 | |
| 19 | syslog S2 -level notice { |
| 20 | recv |
| 21 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy be2 started" |
| 22 | recv |
Christopher Faulet | a67ed43 | 2020-04-20 14:59:20 +0200 | [diff] [blame] | 23 | 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] | 24 | barrier b sync |
| 25 | recv |
Christopher Faulet | 617780f | 2020-04-07 08:00:35 +0200 | [diff] [blame] | 26 | 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] | 27 | } -start |
| 28 | |
| 29 | syslog S3 -level notice { |
| 30 | recv |
| 31 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy be3 started" |
| 32 | recv |
Christopher Faulet | 617780f | 2020-04-07 08:00:35 +0200 | [diff] [blame] | 33 | 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] | 34 | } -start |
| 35 | |
| 36 | syslog S4 -level notice { |
| 37 | recv |
| 38 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy be4 started" |
| 39 | recv |
Christopher Faulet | 617780f | 2020-04-07 08:00:35 +0200 | [diff] [blame] | 40 | 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] | 41 | } -start |
| 42 | |
| 43 | server s1 { |
Christopher Faulet | 617780f | 2020-04-07 08:00:35 +0200 | [diff] [blame] | 44 | send "2" |
| 45 | send "2" |
| 46 | send "0" |
| 47 | send "\r\n\r\n" |
Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 48 | recv 16 |
| 49 | send "2" |
| 50 | send "4" |
| 51 | send "8" |
| 52 | send "\r\n\r\n" |
| 53 | } -start |
| 54 | |
| 55 | server s2 { |
| 56 | rxreq |
| 57 | txresp |
| 58 | } -start |
| 59 | |
| 60 | haproxy h1 -conf { |
| 61 | defaults |
| 62 | timeout client 1s |
| 63 | timeout server 1s |
| 64 | timeout connect 1s |
| 65 | option log-health-checks |
Christopher Faulet | 617780f | 2020-04-07 08:00:35 +0200 | [diff] [blame] | 66 | default-server inter 200ms downinter 100ms rise 1 fall 1 |
Frederic Lecaille | 3ec7bfb | 2018-12-13 22:15:09 +0100 | [diff] [blame] | 67 | |
| 68 | backend be1 |
| 69 | option smtpchk |
| 70 | log ${S1_addr}:${S1_port} daemon |
| 71 | server srv1 ${s1_addr}:${s1_port} check |
| 72 | |
| 73 | backend be2 |
| 74 | mode tcp |
| 75 | log ${S2_addr}:${S2_port} daemon |
| 76 | option httpchk OPTIONS * HTTP/1.1\r\nHost:\ www |
| 77 | server srv2 ${s2_addr}:${s2_port} check |
| 78 | |
| 79 | backend be3 |
| 80 | log ${S3_addr}:${S3_port} daemon |
| 81 | server srv3 255.255.255.255:11111 check |
| 82 | |
| 83 | backend be4 |
| 84 | log ${S4_addr}:${S4_port} daemon |
| 85 | server srv4 localhost:11111 check |
| 86 | } -start |
| 87 | |
| 88 | haproxy h1 -cli { |
| 89 | barrier b sync |
| 90 | send "show servers state" |
| 91 | expect ~ .* |
| 92 | } |
| 93 | |
| 94 | server s1 -wait |
| 95 | server s2 -wait |
| 96 | |
| 97 | syslog S1 -wait |
| 98 | syslog S2 -wait |
| 99 | syslog S3 -wait |
| 100 | syslog S4 -wait |
| 101 | |
| 102 | |