blob: 370c9468dc10a429a72c177eac8ba178585dd6af [file] [log] [blame]
Gaetan Rivet1afd8262020-02-07 15:37:17 +01001varnishtest "tcp-check negative bounded regex match"
2#EXCLUDE_TARGETS=freebsd,osx,generic
3#REGTEST_TYPE=slow
4#REQUIRE_VERSION=2.2
5# This test use a negative expect rule and verify that setting a required
6# minimum amount of data to match.
7feature ignore_unknown_macro
8
9syslog S1 -level notice {
10 recv
Gaetan Rivet1afd8262020-02-07 15:37:17 +010011 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 failed, reason: Layer7 timeout.*at step 2 of tcp-check"
12} -start
13
14syslog S2 -level notice {
15 recv
Gaetan Rivet1afd8262020-02-07 15:37:17 +010016 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv1 succeeded"
17} -start
18
19server s1 {
20 send "valid"
21 delay 0.2
22 expect_close
23} -start
24
25server s2 {
26 send "valid"
27 recv 10
28 send "valid"
29 delay 0.2
30 expect_close
31} -start
32
33haproxy h1 -conf {
34 defaults
35 mode tcp
36 timeout connect 200ms
37 timeout check 500ms
38 timeout server 5s
39 timeout client 5s
40
41 backend be1
42 log ${S1_addr}:${S1_port} len 2048 local0
43 option tcp-check
44 option log-health-checks
45 tcp-check connect
46 tcp-check expect !rstring "^error" comment "negative check"
47 tcp-check expect string "valid" comment "positive check"
48 tcp-check send "0123456789"
49 tcp-check expect string "valid" comment "positive check"
50 server srv1 ${s1_addr}:${s1_port} check inter 200ms rise 1 fall 1
51
52 backend be2
53 log ${S2_addr}:${S2_port} len 2048 local0
54 option tcp-check
55 option log-health-checks
56 tcp-check connect
57 tcp-check expect min-recv 5 !rstring "^error" comment "negative check"
58 tcp-check expect string "valid" comment "positive check"
59 tcp-check send "0123456789"
60 tcp-check expect string "valid" comment "positive check"
61 server srv1 ${s2_addr}:${s2_port} check inter 200ms rise 1 fall 1
62} -start
63
64syslog S1 -wait
65syslog S2 -wait