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.
		
			
				
	
	
		
			91 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			91 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| varnishtest "Add server via cli"
 | |
| 
 | |
| feature ignore_unknown_macro
 | |
| 
 | |
| server s1 {
 | |
| 	rxreq
 | |
| 	txresp
 | |
| } -start
 | |
| 
 | |
| haproxy h1 -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 fe
 | |
| 		bind "fd@${feS}"
 | |
| 		default_backend test
 | |
| 
 | |
| 	backend test
 | |
| 		balance random
 | |
| 
 | |
| 	backend other
 | |
| 		balance static-rr
 | |
| 
 | |
| 	backend other2
 | |
| 		balance random
 | |
| 		mode tcp
 | |
| } -start
 | |
| 
 | |
| client c1 -connect ${h1_feS_sock} {
 | |
| 	txreq
 | |
| 	rxresp
 | |
| 	expect resp.status == 503
 | |
| } -run
 | |
| 
 | |
| haproxy h1 -cli {
 | |
| 	# non existent backend
 | |
| 	send "add server foo/s1 ${s1_addr}:${s1_port}"
 | |
| 	expect ~ "No such backend."
 | |
| 
 | |
| 	# missing address
 | |
| 	send "add server test/s1"
 | |
| 	expect ~ "'server' expects <name> and <addr>\\[:<port>\\] as arguments."
 | |
| 
 | |
| 	# invalid load-balancing algo
 | |
| 	send "add server other/s1 ${s1_addr}:${s1_port}"
 | |
| 	expect ~ "Backend must use a dynamic load balancing to support dynamic servers."
 | |
| 
 | |
| 	# invalid mux proto
 | |
| 	send "add server other2/s1 ${s1_addr}:${s1_port} proto h2"
 | |
| 	expect ~ "MUX protocol is not usable for server."
 | |
| 
 | |
| 	# valid command
 | |
| 	send "add server test/s1 ${s1_addr}:${s1_port}"
 | |
| 	expect ~ "New server registered."
 | |
| 
 | |
| 	# duplicate server
 | |
| 	send "add server test/s1 ${s1_addr}:${s1_port}"
 | |
| 	expect ~ "Already exists a server with the same name in backend."
 | |
| 
 | |
| 	# valid command
 | |
| 	# specify the proto, it should be accepted for this backend
 | |
| 	send "add server test/s2 ${s1_addr}:${s1_port} proto h2"
 | |
| 	expect ~ "New server registered."
 | |
| }
 | |
| 
 | |
| # dynamic servers are created on MAINT mode and should not be available at first
 | |
| client c2 -connect ${h1_feS_sock} {
 | |
| 	txreq
 | |
| 	rxresp
 | |
| 	expect resp.status == 503
 | |
| } -run
 | |
| 
 | |
| haproxy h1 -cli {
 | |
| 	send "enable server test/s1"
 | |
| 	expect ~ ".*"
 | |
| }
 | |
| 
 | |
| client c3 -connect ${h1_feS_sock} {
 | |
| 	txreq
 | |
| 	rxresp
 | |
| 	expect resp.status == 200
 | |
| } -run
 |