Skip to content

Commit e6efcb3

Browse files
committed
move idleTimeout configuration test to its own test case
1 parent 1e567c0 commit e6efcb3

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

core/src/test/java/com/cloud/network/HAProxyConfiguratorTest.java

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,24 @@ public void testGenerateConfigurationLoadBalancerConfigCommand() {
8787
result = genConfig(hpg, cmd);
8888
assertTrue("keepalive enabled should result in 'no option httpclose' in the resulting haproxy config", result.contains("\tno option httpclose"));
8989

90-
cmd = new LoadBalancerConfigCommand(lba, "10.0.0.1", "10.1.0.1", "10.1.1.1", null, 1L, "4", true, 0L);
90+
// TODO
91+
// create lb command
92+
// setup tests for
93+
// maxconn (test for maxpipes as well)
94+
// httpmode
95+
}
96+
97+
/**
98+
* Test method for {@link com.cloud.network.HAProxyConfigurator#generateConfiguration(com.cloud.agent.api.routing.LoadBalancerConfigCommand)}.
99+
*/
100+
@Test
101+
public void testGenerateConfigurationLoadBalancerIdleTimeoutConfigCommand() {
102+
LoadBalancerTO lb = new LoadBalancerTO("1", "10.2.0.1", 80, "http", "bla", false, false, false, null);
103+
LoadBalancerTO[] lba = new LoadBalancerTO[1];
104+
lba[0] = lb;
105+
HAProxyConfigurator hpg = new HAProxyConfigurator();
106+
107+
LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lba, "10.0.0.1", "10.1.0.1", "10.1.1.1", null, 1L, "4", true, 0L);
91108
result = genConfig(hpg, cmd);
92109
assertTrue("idleTimeout of 0 should not generate 'timeout server' in the resulting haproxy config", !result.contains("\ttimeout server"));
93110
assertTrue("idleTimeout of 0 should not generate 'timeout client' in the resulting haproxy config", !result.contains("\ttimeout client"));
@@ -96,12 +113,6 @@ public void testGenerateConfigurationLoadBalancerConfigCommand() {
96113
result = genConfig(hpg, cmd);
97114
assertTrue("idleTimeout of 1234 should result in 'timeout server 1234' in the resulting haproxy config", result.contains("\ttimeout server 1234"));
98115
assertTrue("idleTimeout of 1234 should result in 'timeout client 1234' in the resulting haproxy config", result.contains("\ttimeout client 1234"));
99-
100-
// TODO
101-
// create lb command
102-
// setup tests for
103-
// maxconn (test for maxpipes as well)
104-
// httpmode
105116
}
106117

107118
/**

0 commit comments

Comments
 (0)