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