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