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