Gaetan Rivet | 1afd826 | 2020-02-07 15:37:17 +0100 | [diff] [blame] | 1 | varnishtest "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. |
| 7 | feature ignore_unknown_macro |
| 8 | |
| 9 | syslog S1 -level notice { |
| 10 | recv |
Gaetan Rivet | 1afd826 | 2020-02-07 15:37:17 +0100 | [diff] [blame] | 11 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 failed, reason: Layer7 timeout.*at step 2 of tcp-check" |
| 12 | } -start |
| 13 | |
| 14 | syslog S2 -level notice { |
| 15 | recv |
Gaetan Rivet | 1afd826 | 2020-02-07 15:37:17 +0100 | [diff] [blame] | 16 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv1 succeeded" |
| 17 | } -start |
| 18 | |
| 19 | server s1 { |
| 20 | send "valid" |
| 21 | delay 0.2 |
| 22 | expect_close |
| 23 | } -start |
| 24 | |
| 25 | server s2 { |
| 26 | send "valid" |
| 27 | recv 10 |
| 28 | send "valid" |
| 29 | delay 0.2 |
| 30 | expect_close |
| 31 | } -start |
| 32 | |
| 33 | haproxy h1 -conf { |
| 34 | defaults |
| 35 | mode tcp |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame] | 36 | 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 Rivet | 1afd826 | 2020-02-07 15:37:17 +0100 | [diff] [blame] | 40 | |
| 41 | backend be1 |
Willy Tarreau | b89df41 | 2021-11-18 17:26:25 +0100 | [diff] [blame] | 42 | # must fail fast |
| 43 | timeout check 1 |
| 44 | timeout server 1 |
Gaetan Rivet | 1afd826 | 2020-02-07 15:37:17 +0100 | [diff] [blame] | 45 | 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 | |
| 67 | syslog S1 -wait |
| 68 | syslog S2 -wait |