blob: ffd31235e64db8b4b9c30b5734f831de8c148602 [file] [log] [blame]
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +01001varnishtest "Check: smptchk option"
2feature ignore_unknown_macro
3
Frédéric Lécailledc1a3bd2019-03-29 15:07:24 +01004#REGTEST_TYPE=slow
5
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +01006barrier b cond 3
7
8syslog 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
18syslog 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
28syslog S3 -level notice {
29 recv
30 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy be3 started"
31 recv
Frédéric Lécaille9ffb88d2018-12-20 09:55:43 +010032 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be3/srv3 failed, reason: Layer4 .* check duration: [[:digit:]]+ms, status: 0/1 DOWN."
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +010033} -start
34
35syslog 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
42server s1 {
43 recv 16
44 send "2"
45 send "4"
46 send "8"
47 send "\r\n\r\n"
48} -start
49
50server s2 {
51 rxreq
52 txresp
53} -start
54
55haproxy 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
83haproxy h1 -cli {
84 barrier b sync
85 send "show servers state"
86 expect ~ .*
87}
88
89server s1 -wait
90server s2 -wait
91
92syslog S1 -wait
93syslog S2 -wait
94syslog S3 -wait
95syslog S4 -wait
96
97