blob: ecf8fd059551ab844a7530683e9351b0592bebaf [file] [log] [blame]
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +01001vtest "Basic test for peers protocol"
2feature ignore_unknown_macro
3
Frédéric Lécailleffe30f72019-04-19 11:20:52 +02004#REQUIRE_VERSION=2.0
5
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +01006haproxy 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
27haproxy 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
48haproxy 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
69client c1 -connect ${h1_fe_sock} {
70 txreq -url "c1_client"
71 expect_close
72} -start
73
74client c2 -connect ${h1_fe_sock} {
75 txreq -url "c2_client"
76 expect_close
77} -start
78
79client c3 -connect ${h1_fe_sock} {
80 txreq -url "c3_client"
81 expect_close
82} -start
83
84client c4 -connect ${h1_fe_sock} {
85 txreq -url "c4_client"
86 expect_close
87} -start
88
89haproxy h1 -start
90delay 0.2
91haproxy h2 -start
92delay 0.2
93haproxy h3 -start
94delay 0.2
95
96client c1 -wait
97client c2 -wait
98client c3 -wait
99client c4 -wait
100
101delay 2
102
103haproxy 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
108haproxy 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
113haproxy 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