blob: 1edfae65fe3506d2ab7494687c989fee2195f45e [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}"
Christopher Faulet1448d3a2019-10-14 16:10:52 +020024 tcp-request inspect-delay 100ms
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010025 tcp-request content track-sc0 url table stkt
26 tcp-request content sc-inc-gpc0(0)
27}
28
29haproxy h2 -arg "-L B" -conf {
30 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020031 mode http
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010032 timeout client 1s
33 timeout connect 1s
34 timeout server 1s
35
36 backend stkt
37 stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
38
39 peers peers
40 bind "fd@${B}"
41 server A ${h1_A_addr}:${h1_A_port}
42 server B
43 server C ${h3_C_addr}:${h3_C_port}
44
45 frontend fe
46 bind "fd@${fe}"
47 http-request track-sc0 url table stkt
48 http-request sc-inc-gpc0(0)
49}
50
51haproxy h3 -arg "-L C" -conf {
52 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020053 mode http
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010054 timeout client 1s
55 timeout connect 1s
56 timeout server 1s
57
58 backend stkt
59 stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
60
61 peers peers
62 bind "fd@${C}"
63 server A ${h1_A_addr}:${h1_A_port}
64 server B ${h2_B_addr}:${h2_B_port}
65 server C
66
67 frontend fe
68 bind "fd@${fe}"
69 http-request track-sc0 url table stkt
70 http-request sc-inc-gpc0(0)
71}
72
73client c1 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020074 txreq -url "/c1_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010075 expect_close
76} -start
77
78client c2 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020079 txreq -url "/c2_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010080 expect_close
81} -start
82
83client c3 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020084 txreq -url "/c3_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010085 expect_close
86} -start
87
88client c4 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020089 txreq -url "/c4_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010090 expect_close
91} -start
92
93haproxy h1 -start
94delay 0.2
95haproxy h2 -start
96delay 0.2
97haproxy h3 -start
98delay 0.2
99
100client c1 -wait
101client c2 -wait
102client c3 -wait
103client c4 -wait
104
105delay 2
106
107haproxy h1 -cli {
108 send "show table stkt"
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200109 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}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100110}
111
112haproxy h2 -cli {
113 send "show table stkt"
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200114 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}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100115}
116
117haproxy h3 -cli {
118 send "show table stkt"
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200119 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}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100120}
121