@@ -1522,6 +1522,46 @@ def test_create_vip_port_exception(self):
15221522 self .vip_dict ,
15231523 [])
15241524
1525+ def test_create_vip_port_exception_with_details (self ):
1526+ exception_with_details = Exception ()
1527+ exception_with_details .details = "Network not found"
1528+ with mock .patch .object (ovn_helper .OvnProviderHelper , 'create_vip_port' ,
1529+ side_effect = exception_with_details ):
1530+ self .assertRaises (
1531+ exceptions .DriverError ,
1532+ self .driver .create_vip_port ,
1533+ self .loadbalancer_id ,
1534+ self .project_id ,
1535+ self .vip_dict ,
1536+ [])
1537+
1538+ def test_create_vip_port_exception_with_message (self ):
1539+ exception_with_message = Exception ()
1540+ exception_with_message .message = "Port creation failed"
1541+ with mock .patch .object (ovn_helper .OvnProviderHelper , 'create_vip_port' ,
1542+ side_effect = exception_with_message ):
1543+ self .assertRaises (
1544+ exceptions .DriverError ,
1545+ self .driver .create_vip_port ,
1546+ self .loadbalancer_id ,
1547+ self .project_id ,
1548+ self .vip_dict ,
1549+ [])
1550+
1551+ def test_create_vip_port_exception_with_both_details_and_message (self ):
1552+ exception_with_both = Exception ()
1553+ exception_with_both .details = "Network not found"
1554+ exception_with_both .message = "Port creation failed"
1555+ with mock .patch .object (ovn_helper .OvnProviderHelper , 'create_vip_port' ,
1556+ side_effect = exception_with_both ):
1557+ self .assertRaises (
1558+ exceptions .DriverError ,
1559+ self .driver .create_vip_port ,
1560+ self .loadbalancer_id ,
1561+ self .project_id ,
1562+ self .vip_dict ,
1563+ [])
1564+
15251565 def test_health_monitor_create (self ):
15261566 info = {'id' : self .ref_health_monitor .healthmonitor_id ,
15271567 'pool_id' : self .ref_health_monitor .pool_id ,
@@ -1686,6 +1726,39 @@ def test_ensure_loadbalancer_lb_not_found_without_listeners_or_pools(
16861726 }
16871727 mock_update_status .assert_called_once_with (expected_status )
16881728
1729+ @mock .patch .object (ovn_driver .OvnProviderDriver ,
1730+ '_check_for_supported_protocols' )
1731+ @mock .patch .object (ovn_driver .OvnProviderDriver ,
1732+ '_check_for_supported_algorithms' )
1733+ @mock .patch .object (ovn_driver .OvnProviderDriver ,
1734+ '_check_for_supported_session_persistence' )
1735+ def test_get_pool_request_info_skips_session_persistence (
1736+ self , mck_chck_sup_ses_per , mck_chck_sup_alg , mck_chck_sup_pro ):
1737+ pool = mock .Mock ()
1738+ pool .protocol = 'TCP'
1739+ pool .lb_algorithm = 'SOURCE_IP_PORT'
1740+ pool .pool_id = 'pool-001'
1741+ pool .loadbalancer_id = 'lb-123'
1742+ pool .listener_id = 'listener-999'
1743+ pool .session_persistence = data_models .UnsetType ()
1744+ pool .admin_state_up = data_models .UnsetType ()
1745+
1746+ expected = {
1747+ 'id' : pool .pool_id ,
1748+ 'loadbalancer_id' : pool .loadbalancer_id ,
1749+ 'protocol' : pool .protocol ,
1750+ 'lb_algorithm' : pool .lb_algorithm ,
1751+ 'listener_id' : pool .listener_id ,
1752+ 'admin_state_up' : True
1753+ }
1754+
1755+ result = self .driver ._get_pool_request_info (pool )
1756+
1757+ mck_chck_sup_pro .assert_called_once_with (pool .protocol )
1758+ mck_chck_sup_alg .assert_called_once_with (pool .lb_algorithm )
1759+ mck_chck_sup_ses_per .assert_not_called ()
1760+ self .assertEqual (result , expected )
1761+
16891762 @mock .patch .object (ovn_helper .OvnProviderHelper ,
16901763 '_update_status_to_octavia' )
16911764 @mock .patch .object (ovn_helper .OvnProviderHelper , 'member_create' )
0 commit comments