blob: 14d7b00bc52aa13c221a6830fd85bfcceb5f0639 [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
Frédéric Lécaillec8f931c2019-05-07 11:11:00 +02005#REGTEST_TYPE=slow
Willy Tarreau596ce522019-05-07 07:53:54 +02006
Frédéric Lécaille4d789482019-03-18 14:08:46 +01007haproxy 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
27haproxy 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
46haproxy 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
65client c1 -connect ${h1_fe_sock} {
66 txreq -url "c1_client"
67 expect_close
68} -start
69
70client c2 -connect ${h1_fe_sock} {
71 txreq -url "c2_client"
72 expect_close
73} -start
74
75client c3 -connect ${h1_fe_sock} {
76 txreq -url "c3_client"
77 expect_close
78} -start
79
80client c4 -connect ${h1_fe_sock} {
81 txreq -url "c4_client"
82 expect_close
83} -start
84
85haproxy h1 -start
86delay 0.2
87haproxy h2 -start
88delay 0.2
89haproxy h3 -start
90delay 0.2
91
92client c1 -wait
93client c2 -wait
94client c3 -wait
95client c4 -wait
96
97delay 2
98
99haproxy 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
104haproxy 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
109haproxy 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