Frédéric Lécaille | 3c4fb95 | 2019-01-17 16:15:33 +0100 | [diff] [blame] | 1 | vtest "Basic test for peers protocol" |
| 2 | feature ignore_unknown_macro |
| 3 | |
Frédéric Lécaille | ffe30f7 | 2019-04-19 11:20:52 +0200 | [diff] [blame] | 4 | #REQUIRE_VERSION=2.0 |
Frédéric Lécaille | dc1a3bd | 2019-03-29 15:07:24 +0100 | [diff] [blame] | 5 | #REGTEST_TYPE=slow |
Frédéric Lécaille | ffe30f7 | 2019-04-19 11:20:52 +0200 | [diff] [blame] | 6 | |
Frédéric Lécaille | 3c4fb95 | 2019-01-17 16:15:33 +0100 | [diff] [blame] | 7 | haproxy h1 -arg "-L A" -conf { |
| 8 | defaults |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame^] | 9 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 10 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 11 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
Frédéric Lécaille | 3c4fb95 | 2019-01-17 16:15:33 +0100 | [diff] [blame] | 12 | |
| 13 | backend stkt |
| 14 | stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers |
| 15 | |
| 16 | peers peers |
| 17 | bind "fd@${A}" |
| 18 | server A |
| 19 | server B ${h2_B_addr}:${h2_B_port} |
| 20 | server C ${h3_C_addr}:${h3_C_port} |
| 21 | |
| 22 | frontend fe |
| 23 | bind "fd@${fe}" |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 24 | tcp-request inspect-delay 100ms |
Frédéric Lécaille | 3c4fb95 | 2019-01-17 16:15:33 +0100 | [diff] [blame] | 25 | tcp-request content track-sc0 url table stkt |
| 26 | tcp-request content sc-inc-gpc0(0) |
| 27 | } |
| 28 | |
| 29 | haproxy h2 -arg "-L B" -conf { |
| 30 | defaults |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 31 | mode http |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame^] | 32 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 33 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 34 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
Frédéric Lécaille | 3c4fb95 | 2019-01-17 16:15:33 +0100 | [diff] [blame] | 35 | |
| 36 | backend stkt |
| 37 | stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers |
| 38 | |
| 39 | peers peers |
| 40 | bind "fd@${B}" |
| 41 | server A ${h1_A_addr}:${h1_A_port} |
| 42 | server B |
| 43 | server C ${h3_C_addr}:${h3_C_port} |
| 44 | |
| 45 | frontend fe |
| 46 | bind "fd@${fe}" |
| 47 | http-request track-sc0 url table stkt |
| 48 | http-request sc-inc-gpc0(0) |
| 49 | } |
| 50 | |
| 51 | haproxy h3 -arg "-L C" -conf { |
| 52 | defaults |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 53 | mode http |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame^] | 54 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 55 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 56 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
Frédéric Lécaille | 3c4fb95 | 2019-01-17 16:15:33 +0100 | [diff] [blame] | 57 | |
| 58 | backend stkt |
| 59 | stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers |
| 60 | |
| 61 | peers peers |
| 62 | bind "fd@${C}" |
| 63 | server A ${h1_A_addr}:${h1_A_port} |
| 64 | server B ${h2_B_addr}:${h2_B_port} |
| 65 | server C |
| 66 | |
| 67 | frontend fe |
| 68 | bind "fd@${fe}" |
| 69 | http-request track-sc0 url table stkt |
| 70 | http-request sc-inc-gpc0(0) |
| 71 | } |
| 72 | |
| 73 | client c1 -connect ${h1_fe_sock} { |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 74 | txreq -url "/c1_client" |
Frédéric Lécaille | 3c4fb95 | 2019-01-17 16:15:33 +0100 | [diff] [blame] | 75 | expect_close |
| 76 | } -start |
| 77 | |
| 78 | client c2 -connect ${h1_fe_sock} { |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 79 | txreq -url "/c2_client" |
Frédéric Lécaille | 3c4fb95 | 2019-01-17 16:15:33 +0100 | [diff] [blame] | 80 | expect_close |
| 81 | } -start |
| 82 | |
| 83 | client c3 -connect ${h1_fe_sock} { |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 84 | txreq -url "/c3_client" |
Frédéric Lécaille | 3c4fb95 | 2019-01-17 16:15:33 +0100 | [diff] [blame] | 85 | expect_close |
| 86 | } -start |
| 87 | |
| 88 | client c4 -connect ${h1_fe_sock} { |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 89 | txreq -url "/c4_client" |
Frédéric Lécaille | 3c4fb95 | 2019-01-17 16:15:33 +0100 | [diff] [blame] | 90 | expect_close |
| 91 | } -start |
| 92 | |
| 93 | haproxy h1 -start |
| 94 | delay 0.2 |
| 95 | haproxy h2 -start |
| 96 | delay 0.2 |
| 97 | haproxy h3 -start |
| 98 | delay 0.2 |
| 99 | |
| 100 | client c1 -wait |
| 101 | client c2 -wait |
| 102 | client c3 -wait |
| 103 | client c4 -wait |
| 104 | |
| 105 | delay 2 |
| 106 | |
| 107 | haproxy h1 -cli { |
| 108 | send "show table stkt" |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 109 | expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}" |
Frédéric Lécaille | 3c4fb95 | 2019-01-17 16:15:33 +0100 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | haproxy h2 -cli { |
| 113 | send "show table stkt" |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 114 | expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}" |
Frédéric Lécaille | 3c4fb95 | 2019-01-17 16:15:33 +0100 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | haproxy h3 -cli { |
| 118 | send "show table stkt" |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 119 | expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}" |
Frédéric Lécaille | 3c4fb95 | 2019-01-17 16:15:33 +0100 | [diff] [blame] | 120 | } |
| 121 | |