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