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