@@ -30,6 +30,7 @@ def test_config_frontend_with_virtual_host_without_monitoring_uri_added(self):
3030 cfg , monitor_uri_configured = config_frontend_with_virtual_host (vhosts , "ssl crt /certs/" )
3131 result = OrderedDict ([('frontend port_80' , ['bind :80' ,
3232 'reqadd X-Forwarded-Proto:\\ http' ,
33+ 'maxconn 55555' ,
3334 'acl is_websocket hdr(Upgrade) -i WebSocket' ,
3435 'acl host_rule_1 hdr(host) -i a.com' ,
3536 'acl host_rule_1_port hdr(host) -i a.com:80' ,
@@ -42,6 +43,7 @@ def test_config_frontend_with_virtual_host_with_path_rules(self):
4243 cfg , monitor_uri_configured = config_frontend_with_virtual_host (vhosts , "ssl crt /certs/" )
4344 result = OrderedDict ([('frontend port_80' , ['bind :80' ,
4445 'reqadd X-Forwarded-Proto:\\ http' ,
46+ 'maxconn 55555' ,
4547 'acl is_websocket hdr(Upgrade) -i WebSocket' ,
4648 'acl host_rule_1 hdr_reg(host) -i ^.*$' ,
4749 'acl host_rule_1_port hdr_reg(host) -i ^.*:80$' ,
@@ -57,8 +59,9 @@ def test_config_frontend_with_virtual_host_with_monitoring_uri_added(self):
5759 result = OrderedDict ([('frontend port_9999' ,
5860 ['bind :9999' ,
5961 'reqadd X-Forwarded-Proto:\\ http' ,
60- 'acl is_websocket hdr(Upgrade) -i WebSocket ' ,
62+ 'maxconn 55555 ' ,
6163 'monitor-uri /ping' ,
64+ 'acl is_websocket hdr(Upgrade) -i WebSocket' ,
6265 'acl host_rule_1 hdr(host) -i a.com' ,
6366 'acl host_rule_1_port hdr(host) -i a.com:9999' ,
6467 'use_backend SERVICE_web-a if host_rule_1 or host_rule_1_port' ])])
@@ -130,15 +133,18 @@ def test_config_common_part_with_ssl(self, mock_get_bind_string):
130133 mock_get_bind_string .return_value = ("443 ssl crt /certs/" , True )
131134 frontend_section , monitor_uri_configured = config_common_part ("443" , "ssl crt /certs/" , [])
132135 self .assertEqual (
133- ["bind :443 ssl crt /certs/" , "reqadd X-Forwarded-Proto:\ https" , "acl is_websocket hdr(Upgrade) -i WebSocket" ],
136+ ["bind :443 ssl crt /certs/" , "reqadd X-Forwarded-Proto:\ https" ,
137+ "acl is_websocket hdr(Upgrade) -i WebSocket" ],
134138 frontend_section )
135139 self .assertFalse (monitor_uri_configured )
136140
137141 @mock .patch ("haproxy.helper.frontend_helper.get_bind_string" )
138142 def test_config_common_part_without_ssl (self , mock_get_bind_string ):
139143 mock_get_bind_string .return_value = ("80" , False )
140144 frontend_section , monitor_uri_configured = config_common_part ("80" , "ssl crt /certs/" , [])
141- self .assertEqual (["bind :80" , 'reqadd X-Forwarded-Proto:\\ http' ,
145+ self .assertEqual (["bind :80" ,
146+ 'reqadd X-Forwarded-Proto:\\ http' ,
147+ "maxconn 55555" ,
142148 "acl is_websocket hdr(Upgrade) -i WebSocket" ],
143149 frontend_section )
144150 self .assertFalse (monitor_uri_configured )
@@ -147,8 +153,11 @@ def test_config_common_part_without_ssl(self, mock_get_bind_string):
147153 def test_config_common_part_with_ssl (self , mock_get_bind_string ):
148154 mock_get_bind_string .return_value = ("9999 ssl crt /certs/" , True )
149155 frontend_section , monitor_uri_configured = config_common_part ("9999" , "ssl crt /certs/" , [])
150- self .assertEqual (["bind :9999 ssl crt /certs/" , "reqadd X-Forwarded-Proto:\ https" ,
151- "acl is_websocket hdr(Upgrade) -i WebSocket" , "monitor-uri %s" % frontend_helper .MONITOR_URI ],
156+ self .assertEqual (["bind :9999 ssl crt /certs/" ,
157+ "reqadd X-Forwarded-Proto:\ https" ,
158+ 'maxconn 55555' ,
159+ "monitor-uri %s" % frontend_helper .MONITOR_URI ,
160+ "acl is_websocket hdr(Upgrade) -i WebSocket" ],
152161 frontend_section )
153162 self .assertTrue (monitor_uri_configured )
154163
@@ -168,6 +177,7 @@ def test_config_common_part_with_extra_frontend_sttings(self, mock_get_bind_stri
168177 frontend_helper .EXTRA_FRONTEND_SETTINGS = {'80' : ["reqadd header1 value1" , "reqadd header2 value2" ]}
169178 frontend_section , monitor_uri_configured = config_common_part ("80" , "ssl crt /certs/" , [])
170179 self .assertEqual (["bind :80" , 'reqadd X-Forwarded-Proto:\\ http' ,
180+ 'maxconn 55555' ,
171181 'reqadd header1 value1' ,
172182 'reqadd header2 value2' ,
173183 "acl is_websocket hdr(Upgrade) -i WebSocket" ],
@@ -229,8 +239,9 @@ def test_config_default_front(self):
229239 self .assertEqual (OrderedDict ([('frontend default_port_80' ,
230240 ['bind :80' ,
231241 'reqadd X-Forwarded-Proto:\\ http' ,
242+ 'maxconn 55555' ,
232243 'monitor-uri /ping' ,
233- 'maxconn 55555' , ' default_backend default_service' ])]), cfg )
244+ 'default_backend default_service' ])]), cfg )
234245 self .assertTrue (monitor_uri_configured )
235246
236247 frontend_helper .MONITOR_PORT = "443"
@@ -244,8 +255,8 @@ def test_config_default_front(self):
244255 ('frontend default_port_443' ,
245256 ['bind :443 ssl crt /certs/ accept-proxy' ,
246257 'reqadd X-Forwarded-Proto:\\ https' ,
247- 'monitor-uri /ping' ,
248258 'maxconn 55555' ,
259+ 'monitor-uri /ping' ,
249260 'default_backend default_service' ])]), cfg )
250261 self .assertTrue (monitor_uri_configured )
251262
@@ -254,19 +265,18 @@ def test_config_default_front(self):
254265 self .assertEqual (OrderedDict ([('frontend default_port_80' ,
255266 ['bind :80' ,
256267 'reqadd X-Forwarded-Proto:\\ http' ,
257- 'reqadd header1 value1' ,
258268 'maxconn 55555' ,
269+ 'reqadd header1 value1' ,
259270 'default_backend default_service' ]),
260271 ('frontend default_port_443' ,
261272 ['bind :443 ssl crt /certs/ accept-proxy' ,
262273 'reqadd X-Forwarded-Proto:\\ https' ,
263- 'reqadd header2 value2' ,
264- 'monitor-uri /ping' ,
265274 'maxconn 55555' ,
275+ 'monitor-uri /ping' ,
276+ 'reqadd header2 value2' ,
266277 'default_backend default_service' ])]), cfg )
267278 self .assertTrue (monitor_uri_configured )
268279
269-
270280 def test_config_common_part_with_monitor_uri (self ):
271281 self .assertEqual (OrderedDict (), config_monitor_frontend (True ))
272282 self .assertEqual (OrderedDict ([('frontend monitor' , ['bind :9999' , 'monitor-uri /ping' ])]),
@@ -278,6 +288,3 @@ def test_config_common_part_with_monitor_uri(self):
278288 frontend_helper .MONITOR_PORT = "3333"
279289 self .assertEqual (OrderedDict ([('frontend monitor' , ['bind :3333' , 'monitor-uri /ping' ])]),
280290 config_monitor_frontend (False ))
281-
282- frontend_helper .MONITOR_PORT = "3333"
283- frontend_helper .MONITOR_URI = ""
0 commit comments