Browse Source

Removes generate_lbaas_port_specs method

The _generate_lbaas_port_specs method on the lbaas handler
is not used anymore, it should be removed along with
the unit tests for it.

Change-Id: I3982fc6c292a2823c4581897569e885a27b9e406
Closes-Bug: #1901161
changes/90/759390/2
Kafilat Adeleke 6 months ago
parent
commit
ba12753374
2 changed files with 0 additions and 41 deletions
  1. +0
    -4
      kuryr_kubernetes/controller/handlers/lbaas.py
  2. +0
    -37
      kuryr_kubernetes/tests/unit/controller/handlers/test_lbaas.py

+ 0
- 4
kuryr_kubernetes/controller/handlers/lbaas.py View File

@ -229,10 +229,6 @@ class ServiceHandler(k8s_base.ResourceEventHandler):
return False
def _generate_lbaas_port_specs(self, service):
return [obj_lbaas.LBaaSPortSpec(**port)
for port in utils.get_service_ports(service)]
class EndpointsHandler(k8s_base.ResourceEventHandler):
"""EndpointsHandler handles K8s Endpoints events.


+ 0
- 37
kuryr_kubernetes/tests/unit/controller/handlers/test_lbaas.py View File

@ -19,7 +19,6 @@ import os_vif.objects.network as osv_network
import os_vif.objects.subnet as osv_subnet
from kuryr_kubernetes.controller.handlers import lbaas as h_lbaas
from kuryr_kubernetes.objects import lbaas as obj_lbaas
from kuryr_kubernetes.tests import base as test_base
_SUPPORTED_LISTENER_PROT = ('HTTP', 'HTTPS', 'TCP')
@ -344,42 +343,6 @@ class TestServiceHandler(test_base.TestCase):
m_handler, service, lb_crd)
self.assertFalse(ret)
@mock.patch('kuryr_kubernetes.utils.get_service_ports')
def test_generate_lbaas_port_specs(self, m_get_service_ports):
m_handler = mock.Mock(spec=h_lbaas.ServiceHandler)
m_get_service_ports.return_value = [
{'port': 1, 'name': 'X', 'protocol': 'TCP'},
{'port': 2, 'name': 'Y', 'protocol': 'TCP'}
]
expected_ports = [
obj_lbaas.LBaaSPortSpec(name='X', protocol='TCP', port=1),
obj_lbaas.LBaaSPortSpec(name='Y', protocol='TCP', port=2),
]
ret = h_lbaas.ServiceHandler._generate_lbaas_port_specs(
m_handler, mock.sentinel.service)
self.assertEqual(expected_ports, ret)
m_get_service_ports.assert_called_once_with(
mock.sentinel.service)
@mock.patch('kuryr_kubernetes.utils.get_service_ports')
def test_generate_lbaas_port_specs_udp(self, m_get_service_ports):
m_handler = mock.Mock(spec=h_lbaas.ServiceHandler)
m_get_service_ports.return_value = [
{'port': 1, 'name': 'X', 'protocol': 'TCP'},
{'port': 2, 'name': 'Y', 'protocol': 'UDP'}
]
expected_ports = [
obj_lbaas.LBaaSPortSpec(name='X', protocol='TCP', port=1),
obj_lbaas.LBaaSPortSpec(name='Y', protocol='UDP', port=2),
]
ret = h_lbaas.ServiceHandler._generate_lbaas_port_specs(
m_handler, mock.sentinel.service)
self.assertEqual(expected_ports, ret)
m_get_service_ports.assert_called_once_with(
mock.sentinel.service)
def test_set_lbaas_spec(self):
self.skipTest("skipping until generalised annotation handling is "
"implemented")


Loading…
Cancel
Save