mirror of
				https://git.haproxy.org/git/haproxy.git/
				synced 2025-10-31 16:41:01 +01:00 
			
		
		
		
	When threads are enabled and running on a machine with multiple CCX or multiple nodes, thread groups are now enabled since 3.3-dev2, causing load-balancing algorithms to randomly fail due to incoming connections spreading over multiple groups and using different load balancing indexes. Let's just force "thread-groups 1" into all configs when threads are enabled to avoid this.
		
			
				
	
	
		
			85 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			85 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| #EXCLUDE_TARGETS=osx
 | |
| varnishtest "haproxy ACL, CLI and mCLI spaces"
 | |
| feature ignore_unknown_macro
 | |
| 
 | |
| server s1 {
 | |
|    rxreq
 | |
|    expect req.method == "GET"
 | |
|    txresp
 | |
| } -repeat 2 -start
 | |
| 
 | |
| haproxy h1 -Ws -S -conf {
 | |
|     global
 | |
|     .if feature(THREAD)
 | |
|         thread-groups 1
 | |
|     .endif
 | |
| 
 | |
|   defaults
 | |
|     mode http
 | |
|     timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
 | |
|     timeout client  "${HAPROXY_TEST_TIMEOUT-5s}"
 | |
|     timeout server  "${HAPROXY_TEST_TIMEOUT-5s}"
 | |
| 
 | |
|   frontend fe1
 | |
|     bind "fd@${fe1}"
 | |
| 
 | |
|     http-request deny if { req.hdr(user-agent) -i -m str -f ${testdir}/agents.acl }
 | |
| 
 | |
|     default_backend be1
 | |
| 
 | |
|   backend be1
 | |
|     server s1 ${s1_addr}:${s1_port}
 | |
| 
 | |
| } -start
 | |
| 
 | |
| client c1 -connect ${h1_fe1_sock} {
 | |
|     txreq -hdr "User-Agent: Mon User Agent"
 | |
|     rxresp
 | |
|     expect resp.status == 200
 | |
| } -run
 | |
| 
 | |
| haproxy h1 -cli {
 | |
|   delay 0.1
 | |
|   send "add acl ${testdir}/agents.acl Mon\\ User\\ Agent\\;"
 | |
|   expect ~ .*
 | |
| 
 | |
|   send "show acl ${testdir}/agents.acl"
 | |
|   expect ~ ".*Mon User Agent.*"
 | |
| }
 | |
| 
 | |
| client c1 -connect ${h1_fe1_sock} {
 | |
|     txreq -hdr "User-Agent: Mon User Agent;"
 | |
|     rxresp
 | |
|     expect resp.status == 403
 | |
| } -run
 | |
| 
 | |
| 
 | |
| haproxy h1 -cli {
 | |
|   delay 0.1
 | |
|   send "del acl ${testdir}/agents.acl Mon\\ User\\ Agent\\;"
 | |
|   expect ~ .*
 | |
| 
 | |
|   send "show acl ${testdir}/agents.acl"
 | |
|   expect ~ .*
 | |
| }
 | |
| 
 | |
| client c1 -connect ${h1_fe1_sock} {
 | |
|     txreq -hdr "User-Agent: Mon User Agent;"
 | |
|     rxresp
 | |
|     expect resp.status == 200
 | |
| } -run
 | |
| 
 | |
| 
 | |
| # Try it with the master CLI
 | |
| haproxy h1 -mcli {
 | |
|   delay 0.1
 | |
|   send "@1 add acl ${testdir}/agents.acl Mon\\ User\\ Agent\\;;@1 show acl ${testdir}/agents.acl"
 | |
|   expect ~ ".*Mon User Agent;.*"
 | |
| }
 | |
| 
 | |
| client c1 -connect ${h1_fe1_sock} {
 | |
|     txreq -hdr "User-Agent: Mon User Agent;"
 | |
|     rxresp
 | |
|     expect resp.status == 403
 | |
| } -run
 |