blob: 61ff3c86704e1cdac82855c96107cdcb332b7c01 [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
11 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy be1 started."
12 recv
13 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 failed, reason: Layer7 timeout.*at step 2 of tcp-check"
14} -start
15
16syslog S2 -level notice {
17 recv
18 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy be2 started."
19 recv
20 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv1 succeeded"
21} -start
22
23server s1 {
24 send "valid"
25 delay 0.2
26 expect_close
27} -start
28
29server s2 {
30 send "valid"
31 recv 10
32 send "valid"
33 delay 0.2
34 expect_close
35} -start
36
37haproxy h1 -conf {
38 defaults
39 mode tcp
40 timeout connect 200ms
41 timeout check 500ms
42 timeout server 5s
43 timeout client 5s
44
45 backend be1
46 log ${S1_addr}:${S1_port} len 2048 local0
47 option tcp-check
48 option log-health-checks
49 tcp-check connect
50 tcp-check expect !rstring "^error" comment "negative check"
51 tcp-check expect string "valid" comment "positive check"
52 tcp-check send "0123456789"
53 tcp-check expect string "valid" comment "positive check"
54 server srv1 ${s1_addr}:${s1_port} check inter 200ms rise 1 fall 1
55
56 backend be2
57 log ${S2_addr}:${S2_port} len 2048 local0
58 option tcp-check
59 option log-health-checks
60 tcp-check connect
61 tcp-check expect min-recv 5 !rstring "^error" comment "negative check"
62 tcp-check expect string "valid" comment "positive check"
63 tcp-check send "0123456789"
64 tcp-check expect string "valid" comment "positive check"
65 server srv1 ${s2_addr}:${s2_port} check inter 200ms rise 1 fall 1
66} -start
67
68syslog S1 -wait
69syslog S2 -wait