From 635cf80fc584c21157059e0ccd0eeb6a86be169a Mon Sep 17 00:00:00 2001 From: Jon Uriarte Date: Thu, 13 Jan 2022 12:29:19 +0000 Subject: [PATCH] Define new test_endpoints_object_removal config option There are some old kuryr-kubernetes versions that don't support LB pool members removal upon endpoint deletion. For such cases, and in order to be able to run the test test_service_without_selector for all the versions, a new configuration option test_endpoints_object_removal is defined. It's expected to set test_endpoints_object_removal to False in those environments where the removal is not supported, and keep it to the default True value in the rest of them. Change-Id: I8c2d6e8e66d707fcf22311456c0584a6167acea1 --- kuryr_tempest_plugin/config.py | 3 +++ kuryr_tempest_plugin/tests/scenario/test_service.py | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/kuryr_tempest_plugin/config.py b/kuryr_tempest_plugin/config.py index c33ac9e1..d7a9926d 100644 --- a/kuryr_tempest_plugin/config.py +++ b/kuryr_tempest_plugin/config.py @@ -96,6 +96,9 @@ kuryr_k8s_opts = [ cfg.BoolOpt("test_services_without_selector", default=False, help="Whether or not service without selector tests will be " "running"), + cfg.BoolOpt("test_endpoints_object_removal", default=True, + help="Whether to check that LB members are deleted upon " + "endpoints object removal or not"), cfg.BoolOpt("test_configurable_listener_timeouts", default=False, help="Whether or not listener timeout values are " "configurable"), diff --git a/kuryr_tempest_plugin/tests/scenario/test_service.py b/kuryr_tempest_plugin/tests/scenario/test_service.py index fdbaf379..41497e20 100644 --- a/kuryr_tempest_plugin/tests/scenario/test_service.py +++ b/kuryr_tempest_plugin/tests/scenario/test_service.py @@ -156,12 +156,13 @@ class TestServiceWithoutSelectorScenario(base.BaseKuryrScenarioTest): pool_query = "loadbalancer_id=%s" % klb_crd_id pool = self.wait_for_status(timeout, 15, self.pool_client.list_pools, query_params=pool_query) - pool_id = pool[0].get('id') - # Check that there no pool members after endpoint deletion - self.delete_endpoint(ep_name=self.endpoint.metadata.name, - namespace=ns_name) - self.check_lb_members(pool_id, 0) + if CONF.kuryr_kubernetes.test_endpoints_object_removal: + # Check that there are no pool members after endpoint deletion + pool_id = pool[0].get('id') + self.delete_endpoint(ep_name=self.endpoint.metadata.name, + namespace=ns_name) + self.check_lb_members(pool_id, 0) class TestSCTPServiceScenario(base.BaseKuryrScenarioTest):