@@ -79,13 +79,24 @@ public void testGenerateConfigurationLoadBalancerConfigCommand() {
7979 LoadBalancerTO [] lba = new LoadBalancerTO [1 ];
8080 lba [0 ] = lb ;
8181 HAProxyConfigurator hpg = new HAProxyConfigurator ();
82- LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand (lba , "10.0.0.1" , "10.1.0.1" , "10.1.1.1" , null , 1L , "12" , false );
82+ LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand (lba , "10.0.0.1" , "10.1.0.1" , "10.1.1.1" , null , 1L , "12" , false , 0L );
8383 String result = genConfig (hpg , cmd );
8484 assertTrue ("keepalive disabled should result in 'option httpclose' in the resulting haproxy config" , result .contains ("\t option httpclose" ));
8585
86- cmd = new LoadBalancerConfigCommand (lba , "10.0.0.1" , "10.1.0.1" , "10.1.1.1" , null , 1L , "4" , true );
86+ cmd = new LoadBalancerConfigCommand (lba , "10.0.0.1" , "10.1.0.1" , "10.1.1.1" , null , 1L , "4" , true , 0L );
8787 result = genConfig (hpg , cmd );
8888 assertTrue ("keepalive enabled should result in 'no option httpclose' in the resulting haproxy config" , result .contains ("\t no option httpclose" ));
89+
90+ cmd = new LoadBalancerConfigCommand (lba , "10.0.0.1" , "10.1.0.1" , "10.1.1.1" , null , 1L , "4" , true , 0L );
91+ result = genConfig (hpg , cmd );
92+ assertTrue ("idleTimeout of 0 should not generate 'timeout server' in the resulting haproxy config" , !result .contains ("\t timeout server" ));
93+ assertTrue ("idleTimeout of 0 should not generate 'timeout client' in the resulting haproxy config" , !result .contains ("\t timeout client" ));
94+
95+ cmd = new LoadBalancerConfigCommand (lba , "10.0.0.1" , "10.1.0.1" , "10.1.1.1" , null , 1L , "4" , true , 1234L );
96+ result = genConfig (hpg , cmd );
97+ assertTrue ("idleTimeout of 1234 should result in 'timeout server 1234' in the resulting haproxy config" , result .contains ("\t timeout server 1234" ));
98+ assertTrue ("idleTimeout of 1234 should result in 'timeout client 1234' in the resulting haproxy config" , result .contains ("\t timeout client 1234" ));
99+
89100 // TODO
90101 // create lb command
91102 // setup tests for
@@ -106,7 +117,7 @@ public void testGenerateConfigurationLoadBalancerProxyProtocolConfigCommand() {
106117 LoadBalancerTO [] lba = new LoadBalancerTO [1 ];
107118 lba [0 ] = lb ;
108119 HAProxyConfigurator hpg = new HAProxyConfigurator ();
109- LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand (lba , "10.0.0.1" , "10.1.0.1" , "10.1.1.1" , null , 1L , "12" , false );
120+ LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand (lba , "10.0.0.1" , "10.1.0.1" , "10.1.1.1" , null , 1L , "12" , false , 0L );
110121 String result = genConfig (hpg , cmd );
111122 assertTrue ("'send-proxy' should result if protocol is 'tcp-proxy'" , result .contains ("send-proxy" ));
112123 }
@@ -118,7 +129,7 @@ public void generateConfigurationTestWithCidrList() {
118129 LoadBalancerTO [] lba = new LoadBalancerTO [1 ];
119130 lba [0 ] = lb ;
120131 HAProxyConfigurator hpg = new HAProxyConfigurator ();
121- LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand (lba , "10.0.0.1" , "10.1.0.1" , "10.1.1.1" , null , 1L , "12" , false );
132+ LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand (lba , "10.0.0.1" , "10.1.0.1" , "10.1.1.1" , null , 1L , "12" , false , 0L );
122133 String result = genConfig (hpg , cmd );
123134 Assert .assertTrue (result .contains ("acl network_allowed src 1.1.1.1 2.2.2.2/24 \n \t tcp-request connection reject if !network_allowed" ));
124135 }
@@ -131,7 +142,7 @@ public void generateConfigurationTestWithSslCert() {
131142 LoadBalancerTO [] lba = new LoadBalancerTO [1 ];
132143 lba [0 ] = lb ;
133144 HAProxyConfigurator hpg = new HAProxyConfigurator ();
134- LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand (lba , "10.0.0.1" , "10.1.0.1" , "10.1.1.1" , null , 1L , "12" , false );
145+ LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand (lba , "10.0.0.1" , "10.1.0.1" , "10.1.1.1" , null , 1L , "12" , false , 0L );
135146 String result = genConfig (hpg , cmd );
136147 Assert .assertTrue (result .contains ("bind 10.2.0.1:443 ssl crt /etc/cloudstack/ssl/10_2_0_1-443.pem" ));
137148 }
0 commit comments