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