@@ -521,5 +521,53 @@ def test_10_lb_reverse_proxy_http_compression(self):
521
521
with self .assertRaises (ConfigSessionError ) as e :
522
522
self .cli_commit ()
523
523
524
+ def test_11_lb_haproxy_timeout (self ):
525
+ t_default_check = '5'
526
+ t_default_client = '50'
527
+ t_default_connect = '10'
528
+ t_default_server = '50'
529
+ t_check = '4'
530
+ t_client = '300'
531
+ t_connect = '12'
532
+ t_server = '120'
533
+ t_front_client = '600'
534
+
535
+ self .base_config ()
536
+ self .cli_commit ()
537
+ # Check default timeout options
538
+ config_entries = (
539
+ f'timeout check { t_default_check } s' ,
540
+ f'timeout connect { t_default_connect } s' ,
541
+ f'timeout client { t_default_client } s' ,
542
+ f'timeout server { t_default_server } s' ,
543
+ )
544
+ # Check default timeout options
545
+ config = read_file (HAPROXY_CONF )
546
+ for config_entry in config_entries :
547
+ self .assertIn (config_entry , config )
548
+
549
+ # Set custom timeout options
550
+ self .cli_set (base_path + ['timeout' , 'check' , t_check ])
551
+ self .cli_set (base_path + ['timeout' , 'client' , t_client ])
552
+ self .cli_set (base_path + ['timeout' , 'connect' , t_connect ])
553
+ self .cli_set (base_path + ['timeout' , 'server' , t_server ])
554
+ self .cli_set (base_path + ['service' , 'https_front' , 'timeout' , 'client' , t_front_client ])
555
+
556
+ self .cli_commit ()
557
+
558
+ # Check custom timeout options
559
+ config_entries = (
560
+ f'timeout check { t_check } s' ,
561
+ f'timeout connect { t_connect } s' ,
562
+ f'timeout client { t_client } s' ,
563
+ f'timeout server { t_server } s' ,
564
+ f'timeout client { t_front_client } s' ,
565
+ )
566
+
567
+ # Check configured options
568
+ config = read_file (HAPROXY_CONF )
569
+ for config_entry in config_entries :
570
+ self .assertIn (config_entry , config )
571
+
524
572
if __name__ == '__main__' :
525
573
unittest .main (verbosity = 2 )
0 commit comments