Skip to content

Commit 08d5e26

Browse files
committed
test(load-balancer): cover full http service config in add_service test
1 parent 81a2535 commit 08d5e26

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

‎tests/unit/load_balancers/test_client.py‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
LoadBalancerHealthCheck,
1414
LoadBalancersClient,
1515
LoadBalancerService,
16+
LoadBalancerServiceHttp,
1617
LoadBalancerTarget,
1718
LoadBalancerTargetIP,
1819
LoadBalancerTargetLabelSelector,
@@ -383,13 +384,38 @@ def test_add_service(
383384
):
384385
request_mock.return_value = response_add_service
385386

386-
service = LoadBalancerService(listen_port=80, protocol="http")
387+
service = LoadBalancerService(
388+
listen_port=80,
389+
protocol="http",
390+
destination_port=8080,
391+
proxyprotocol=False,
392+
http=LoadBalancerServiceHttp(
393+
cookie_name="HCLBSTICKY",
394+
cookie_lifetime=300,
395+
redirect_http=True,
396+
sticky_sessions=True,
397+
timeout_idle=60,
398+
),
399+
)
387400
action = resource_client.add_service(load_balancer, service)
388401

389402
request_mock.assert_called_with(
390403
method="POST",
391404
url="/load_balancers/1/actions/add_service",
392-
json={"protocol": "http", "listen_port": 80},
405+
json={
406+
"protocol": "http",
407+
"listen_port": 80,
408+
"destination_port": 8080,
409+
"proxyprotocol": False,
410+
"http": {
411+
"cookie_name": "HCLBSTICKY",
412+
"cookie_lifetime": 300,
413+
"redirect_http": True,
414+
"sticky_sessions": True,
415+
"timeout_idle": 60,
416+
"certificates": [],
417+
},
418+
},
393419
)
394420

395421
assert action.id == 13

0 commit comments

Comments
 (0)