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