blob: 81f93e002f5824b80da503ddded77a2148281a76 [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
Willy Tarreauf6739232021-11-18 17:46:22 +010036 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
37 timeout check "${HAPROXY_TEST_TIMEOUT-5s}"
38 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
39 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
Gaetan Rivet1afd8262020-02-07 15:37:17 +010040
41 backend be1
Willy Tarreaub89df412021-11-18 17:26:25 +010042 # must fail fast
43 timeout check 1
44 timeout server 1
Gaetan Rivet1afd8262020-02-07 15:37:17 +010045 log ${S1_addr}:${S1_port} len 2048 local0
46 option tcp-check
47 option log-health-checks
48 tcp-check connect
49 tcp-check expect !rstring "^error" comment "negative check"
50 tcp-check expect string "valid" comment "positive check"
51 tcp-check send "0123456789"
52 tcp-check expect string "valid" comment "positive check"
53 server srv1 ${s1_addr}:${s1_port} check inter 200ms rise 1 fall 1
54
55 backend be2
56 log ${S2_addr}:${S2_port} len 2048 local0
57 option tcp-check
58 option log-health-checks
59 tcp-check connect
60 tcp-check expect min-recv 5 !rstring "^error" comment "negative check"
61 tcp-check expect string "valid" comment "positive check"
62 tcp-check send "0123456789"
63 tcp-check expect string "valid" comment "positive check"
64 server srv1 ${s2_addr}:${s2_port} check inter 200ms rise 1 fall 1
65} -start
66
67syslog S1 -wait
68syslog S2 -wait