blob: 0dce75f69bf65bebda5c2d5f9998ccd5d1f1a3d8 [file] [log] [blame]
Frédéric Lécaille4d789482019-03-18 14:08:46 +01001vtest "Basic test for peers protocol stick-table declared in peers sections"
2feature ignore_unknown_macro
3
Willy Tarreau596ce522019-05-07 07:53:54 +02004#REQUIRE_VERSION=2.0
Frédéric Lécaillec8f931c2019-05-07 11:11:00 +02005#REGTEST_TYPE=slow
Willy Tarreau596ce522019-05-07 07:53:54 +02006
Frédéric Lécaille4d789482019-03-18 14:08:46 +01007haproxy h1 -arg "-L A" -conf {
8 defaults
9 timeout client 1s
10 timeout connect 1s
11 timeout server 1s
12
13
14 peers peers
15 bind "fd@${A}"
16 server A
17 server B ${h2_B_addr}:${h2_B_port}
18 server C ${h3_C_addr}:${h3_C_port}
19 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
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écaille4d789482019-03-18 14:08:46 +010024 tcp-request content track-sc0 url table peers/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
Frédéric Lécaille4d789482019-03-18 14:08:46 +010031 timeout client 1s
32 timeout connect 1s
33 timeout server 1s
34
35 peers peers
36 bind "fd@${B}"
37 server A ${h1_A_addr}:${h1_A_port}
38 server B
39 server C ${h3_C_addr}:${h3_C_port}
40 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
41
42 frontend fe
43 bind "fd@${fe}"
44 http-request track-sc0 url table peers/stkt
45 http-request sc-inc-gpc0(0)
46}
47
48haproxy h3 -arg "-L C" -conf {
49 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020050 mode http
Frédéric Lécaille4d789482019-03-18 14:08:46 +010051 timeout client 1s
52 timeout connect 1s
53 timeout server 1s
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 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
61
62 frontend fe
63 bind "fd@${fe}"
64 http-request track-sc0 url table peers/stkt
65 http-request sc-inc-gpc0(0)
66}
67
68client c1 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020069 txreq -url "/c1_client"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010070 expect_close
71} -start
72
73client c2 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020074 txreq -url "/c2_client"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010075 expect_close
76} -start
77
78client c3 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020079 txreq -url "/c3_client"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010080 expect_close
81} -start
82
83client c4 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020084 txreq -url "/c4_client"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010085 expect_close
86} -start
87
88haproxy h1 -start
89delay 0.2
90haproxy h2 -start
91delay 0.2
92haproxy h3 -start
93delay 0.2
94
95client c1 -wait
96client c2 -wait
97client c3 -wait
98client c4 -wait
99
100delay 2
101
102haproxy h1 -cli {
103 send "show table peers/stkt"
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200104 expect ~ "# table: peers/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écaille4d789482019-03-18 14:08:46 +0100105}
106
107haproxy h2 -cli {
108 send "show table peers/stkt"
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200109 expect ~ "# table: peers/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écaille4d789482019-03-18 14:08:46 +0100110}
111
112haproxy h3 -cli {
113 send "show table peers/stkt"
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200114 expect ~ "# table: peers/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écaille4d789482019-03-18 14:08:46 +0100115}
116