blob: 5c0cb4117c1f326cc3b58091e6e9b8f250fb9585 [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écailledc1a3bd2019-03-29 15:07:24 +01004#REGTEST_TYPE=slow
Frédéric Lécailleffe30f72019-04-19 11:20:52 +02005
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +01006haproxy h1 -arg "-L A" -conf {
7 defaults
Willy Tarreauf6739232021-11-18 17:46:22 +01008 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
9 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
10 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010011
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}"
Christopher Faulet1448d3a2019-10-14 16:10:52 +020023 tcp-request inspect-delay 100ms
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010024 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
Christopher Faulet1448d3a2019-10-14 16:10:52 +020030 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010031 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
32 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
33 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010034
35 backend stkt
36 stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
37
38 peers peers
39 bind "fd@${B}"
40 server A ${h1_A_addr}:${h1_A_port}
41 server B
42 server C ${h3_C_addr}:${h3_C_port}
43
44 frontend fe
45 bind "fd@${fe}"
46 http-request track-sc0 url table stkt
47 http-request sc-inc-gpc0(0)
48}
49
50haproxy h3 -arg "-L C" -conf {
51 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020052 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010053 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
54 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
55 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010056
57 backend stkt
58 stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
59
60 peers peers
61 bind "fd@${C}"
62 server A ${h1_A_addr}:${h1_A_port}
63 server B ${h2_B_addr}:${h2_B_port}
64 server C
65
66 frontend fe
67 bind "fd@${fe}"
68 http-request track-sc0 url table stkt
69 http-request sc-inc-gpc0(0)
70}
71
72client c1 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020073 txreq -url "/c1_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010074 expect_close
75} -start
76
77client c2 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020078 txreq -url "/c2_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010079 expect_close
80} -start
81
82client c3 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020083 txreq -url "/c3_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010084 expect_close
85} -start
86
87client c4 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020088 txreq -url "/c4_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010089 expect_close
90} -start
91
92haproxy h1 -start
93delay 0.2
94haproxy h2 -start
95delay 0.2
96haproxy h3 -start
97delay 0.2
98
99client c1 -wait
100client c2 -wait
101client c3 -wait
102client c4 -wait
103
104delay 2
105
106haproxy h1 -cli {
107 send "show table stkt"
Willy Tarreau5a63e722022-11-29 16:29:12 +0100108 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 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100109}
110
111haproxy h2 -cli {
112 send "show table stkt"
Willy Tarreau5a63e722022-11-29 16:29:12 +0100113 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 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100114}
115
116haproxy h3 -cli {
117 send "show table stkt"
Willy Tarreau5a63e722022-11-29 16:29:12 +0100118 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 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100119}
120