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 |
| 9 | timeout client 1s |
| 10 | timeout connect 1s |
| 11 | timeout server 1s |
| 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}" |
| 24 | tcp-request content track-sc0 url table stkt |
| 25 | tcp-request content sc-inc-gpc0(0) |
| 26 | } |
| 27 | |
| 28 | haproxy h2 -arg "-L B" -conf { |
| 29 | defaults |
| 30 | timeout client 1s |
| 31 | timeout connect 1s |
| 32 | timeout server 1s |
| 33 | |
| 34 | backend stkt |
| 35 | stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers |
| 36 | |
| 37 | peers peers |
| 38 | bind "fd@${B}" |
| 39 | server A ${h1_A_addr}:${h1_A_port} |
| 40 | server B |
| 41 | server C ${h3_C_addr}:${h3_C_port} |
| 42 | |
| 43 | frontend fe |
| 44 | bind "fd@${fe}" |
| 45 | http-request track-sc0 url table stkt |
| 46 | http-request sc-inc-gpc0(0) |
| 47 | } |
| 48 | |
| 49 | haproxy h3 -arg "-L C" -conf { |
| 50 | defaults |
| 51 | timeout client 1s |
| 52 | timeout connect 1s |
| 53 | timeout server 1s |
| 54 | |
| 55 | backend stkt |
| 56 | stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers |
| 57 | |
| 58 | peers peers |
| 59 | bind "fd@${C}" |
| 60 | server A ${h1_A_addr}:${h1_A_port} |
| 61 | server B ${h2_B_addr}:${h2_B_port} |
| 62 | server C |
| 63 | |
| 64 | frontend fe |
| 65 | bind "fd@${fe}" |
| 66 | http-request track-sc0 url table stkt |
| 67 | http-request sc-inc-gpc0(0) |
| 68 | } |
| 69 | |
| 70 | client c1 -connect ${h1_fe_sock} { |
| 71 | txreq -url "c1_client" |
| 72 | expect_close |
| 73 | } -start |
| 74 | |
| 75 | client c2 -connect ${h1_fe_sock} { |
| 76 | txreq -url "c2_client" |
| 77 | expect_close |
| 78 | } -start |
| 79 | |
| 80 | client c3 -connect ${h1_fe_sock} { |
| 81 | txreq -url "c3_client" |
| 82 | expect_close |
| 83 | } -start |
| 84 | |
| 85 | client c4 -connect ${h1_fe_sock} { |
| 86 | txreq -url "c4_client" |
| 87 | expect_close |
| 88 | } -start |
| 89 | |
| 90 | haproxy h1 -start |
| 91 | delay 0.2 |
| 92 | haproxy h2 -start |
| 93 | delay 0.2 |
| 94 | haproxy h3 -start |
| 95 | delay 0.2 |
| 96 | |
| 97 | client c1 -wait |
| 98 | client c2 -wait |
| 99 | client c3 -wait |
| 100 | client c4 -wait |
| 101 | |
| 102 | delay 2 |
| 103 | |
| 104 | haproxy h1 -cli { |
| 105 | send "show table stkt" |
| 106 | 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}" |
| 107 | } |
| 108 | |
| 109 | haproxy h2 -cli { |
| 110 | send "show table stkt" |
| 111 | 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}" |
| 112 | } |
| 113 | |
| 114 | haproxy h3 -cli { |
| 115 | send "show table stkt" |
| 116 | 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}" |
| 117 | } |
| 118 | |