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