blob: 5c56e653dc7e862901f8c37959258f035430b101 [file] [log] [blame]
Frédéric Lécaille85a7ea02019-04-25 20:14:43 +02001varnishtest "Basic log load-balancing test"
2feature ignore_unknown_macro
3
Frédéric Lécaille85a7ea02019-04-25 20:14:43 +02004barrier b1 cond 2 -cyclic
5barrier b2 cond 2 -cyclic
6barrier b3 cond 2 -cyclic
7barrier b4 cond 2 -cyclic
8barrier b5 cond 2 -cyclic
9
10server s1 {
11 rxreq
12 txresp
13} -repeat 500 -start
14
15syslog Slg_1 -level info {
16 recv
17 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c1 HTTP/1.1\""
18 recv
19 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c2 HTTP/1.1\""
20 recv
21 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c3 HTTP/1.1\""
22 recv
23 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c4 HTTP/1.1\""
24 recv
25 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c5 HTTP/1.1\""
26} -repeat 50 -start
27
28# Here are the syslog messages received by Slg_2:
29syslog Slg_2 -level info {
30 recv
Willy Tarreau43ba3cf2020-09-24 09:57:32 +020031 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c6 HTTP/1.1\""
Frédéric Lécaille85a7ea02019-04-25 20:14:43 +020032 recv
Willy Tarreau43ba3cf2020-09-24 09:57:32 +020033 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c8 HTTP/1.1\""
Frédéric Lécaille85a7ea02019-04-25 20:14:43 +020034} -repeat 50 -start
35
36haproxy h1 -conf {
37 global
38 nbthread 1
39
40 defaults
41 mode http
42 option httplog
Willy Tarreauf6739232021-11-18 17:46:22 +010043 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
44 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
45 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille85a7ea02019-04-25 20:14:43 +020046
47 frontend fe1
48 bind "fd@${fe_1}"
49 log ${Slg_1_addr}:${Slg_1_port} local0
50 default_backend be
51
52 frontend fe2
53 bind "fd@${fe_2}"
54 log ${Slg_2_addr}:${Slg_2_port} sample 1,3:5 local0
55 default_backend be
56
57 backend be
58 server app1 ${s1_addr}:${s1_port}
59} -start
60
61# The following client are started in background and synchronized
62client c1 -connect ${h1_fe_1_sock} {
63 txreq -url "/client_c1"
64 rxresp
65 expect resp.status == 200
66 barrier b1 sync
67 barrier b5 sync
68} -repeat 50 -start
69
70client c2 -connect ${h1_fe_1_sock} {
71 barrier b1 sync
72 txreq -url "/client_c2"
73 rxresp
74 expect resp.status == 200
75 barrier b2 sync
76} -repeat 50 -start
77
78client c3 -connect ${h1_fe_1_sock} {
79 barrier b2 sync
80 txreq -url "/client_c3"
81 rxresp
82 expect resp.status == 200
83 barrier b3 sync
84} -repeat 50 -start
85
86client c4 -connect ${h1_fe_1_sock} {
87 barrier b3 sync
88 txreq -url "/client_c4"
89 rxresp
90 expect resp.status == 200
91 barrier b4 sync
92} -repeat 50 -start
93
94client c5 -connect ${h1_fe_1_sock} {
95 barrier b4 sync
96 txreq -url "/client_c5"
97 rxresp
98 expect resp.status == 200
99 barrier b5 sync
100} -repeat 50 -start
101
102syslog Slg_1 -wait
103
104client c1 -wait
105client c2 -wait
106client c3 -wait
107client c4 -wait
108client c5 -wait
109
110# Same test as before but with fe2 frontend.
111# The following client are started in background and synchronized
112client c6 -connect ${h1_fe_2_sock} {
113 txreq -url "/client_c6"
114 rxresp
115 expect resp.status == 200
116 barrier b1 sync
117 barrier b5 sync
118} -repeat 50 -start
119
120client c7 -connect ${h1_fe_2_sock} {
121 barrier b1 sync
122 txreq -url "/client_c7"
123 rxresp
124 expect resp.status == 200
125 barrier b2 sync
126} -repeat 50 -start
127
128client c8 -connect ${h1_fe_2_sock} {
129 barrier b2 sync
130 txreq -url "/client_c8"
131 rxresp
132 expect resp.status == 200
133 barrier b3 sync
134} -repeat 50 -start
135
136client c9 -connect ${h1_fe_2_sock} {
137 barrier b3 sync
138 txreq -url "/client_c9"
139 rxresp
140 expect resp.status == 200
141 barrier b4 sync
142} -repeat 50 -start
143
144client c10 -connect ${h1_fe_2_sock} {
145 barrier b4 sync
146 txreq -url "/client_c10"
147 rxresp
148 expect resp.status == 200
149 barrier b5 sync
150} -repeat 50 -start
151
152syslog Slg_2 -wait
153
154client c6 -wait
155client c7 -wait
156client c8 -wait
157client c9 -wait
158client c10 -wait
159