Create service with unsupported type

Check that kuryr-controller doesn't crash when creating a service
of unsupported type (NodePort)

Change-Id: I0e83ca819a31d310b5be3af94ea1af8acfdc4c01
This commit is contained in:
Genadi 2018-07-10 13:58:27 +03:00 committed by Genadi Chereshnya
parent aa14753dec
commit 2f12fdd664
2 changed files with 30 additions and 0 deletions

View File

@ -358,3 +358,26 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
ssh_client = self.get_remote_client(fip['floating_ip_address'],
private_key=keypair['private_key'])
return ssh_client, fip
def check_controller_pod_status_for_time_period(self, retry_attempts=20,
time_between_attempts=5,
status='Running'):
# Check that the controller pod status doesn't change from provided
# status parameter, so for example it should stay in Running state when
# the service with incorrect parameters was created
controller_pods = [
pod.metadata.name for pod in
self.k8s_client.CoreV1Api().list_namespaced_pod(
namespace=CONF.kuryr_kubernetes.kube_system_namespace).items
if pod.metadata.name.startswith('kuryr-controller')]
while retry_attempts != 0:
time.sleep(time_between_attempts)
for controller_pod in controller_pods:
self.assertEqual("Running", self.get_pod_status(
controller_pod,
CONF.kuryr_kubernetes.kube_system_namespace),
'Kuryr controller is not in the %s state' % status
)
retry_attempts -= 1

View File

@ -114,3 +114,10 @@ class TestLoadBalancerServiceScenario(base.BaseKuryrScenarioTest):
def curl():
return ssh_client.exec_command(cmd)
self._run_and_assert_fn(curl)
@decorators.idempotent_id('bddf5441-1244-449d-a125-b5fdbfc1b2a7')
def test_unsupported_service_type(self):
# Testing that kuryr controller didn't crash for 100 seconds since
# creation of service with unsupported type
self.create_setup_for_service_test(spec_type="NodePort", get_ip=False)
self.check_controller_pod_status_for_time_period()