Merge "Ensure CRD validation is only checked if enabled"
This commit is contained in:
@@ -71,4 +71,6 @@ kuryr_k8s_opts = [
|
||||
"have a multi-worker setup"),
|
||||
cfg.BoolOpt("cloud_provider", default=False, help="Whether or not a "
|
||||
"cloud provider is set"),
|
||||
cfg.BoolOpt("validate_crd", default=False, help="Whether or not kuryr "
|
||||
"CRDs should be validated"),
|
||||
]
|
||||
|
||||
@@ -282,6 +282,9 @@ class TestNamespaceScenario(base.BaseKuryrScenarioTest):
|
||||
|
||||
@decorators.idempotent_id('90b7cb81-f80e-4ff3-9892-9e5fdcd08289')
|
||||
def test_create_kuryrnet_crd_without_net_id(self):
|
||||
if not CONF.kuryr_kubernetes.validate_crd:
|
||||
raise self.skipException('CRD validation must be enabled to run '
|
||||
'this test.')
|
||||
kuryrnet = dict(self._get_kuryrnet_obj())
|
||||
del kuryrnet['spec']['netId']
|
||||
error_msg = 'spec.netId in body is required'
|
||||
@@ -289,6 +292,9 @@ class TestNamespaceScenario(base.BaseKuryrScenarioTest):
|
||||
|
||||
@decorators.idempotent_id('94641749-9fdf-4fb2-a46d-064f75eac113')
|
||||
def test_create_kuryrnet_crd_with_populated_as_string(self):
|
||||
if not CONF.kuryr_kubernetes.validate_crd:
|
||||
raise self.skipException('CRD validation must be enabled to run '
|
||||
'this test.')
|
||||
kuryrnet = dict(self._get_kuryrnet_obj())
|
||||
kuryrnet['spec']['populated'] = 'False'
|
||||
error_msg = 'spec.populated in body must be of type boolean'
|
||||
|
||||
@@ -234,6 +234,9 @@ class TestNetworkPolicyScenario(base.BaseKuryrScenarioTest):
|
||||
|
||||
@decorators.idempotent_id('09a24a0f-322a-40ea-bb89-5b2246c8725d')
|
||||
def test_create_knp_crd_without_ingress_rules(self):
|
||||
if not CONF.kuryr_kubernetes.validate_crd:
|
||||
raise self.skipException('CRD validation must be enabled to run '
|
||||
'this test.')
|
||||
np_name = 'test'
|
||||
knp_obj = dict(self._get_knp_obj(np_name))
|
||||
del knp_obj['spec']['ingressSgRules']
|
||||
@@ -242,6 +245,9 @@ class TestNetworkPolicyScenario(base.BaseKuryrScenarioTest):
|
||||
|
||||
@decorators.idempotent_id('f036d26e-f603-4d00-ad92-b409b5a3ee6c')
|
||||
def test_create_knp_crd_without_sg_rule_id(self):
|
||||
if not CONF.kuryr_kubernetes.validate_crd:
|
||||
raise self.skipException('CRD validation must be enabled to run '
|
||||
'this test.')
|
||||
np_name = 'test'
|
||||
sg_rule = dict(self._get_sg_rule())
|
||||
del sg_rule['id']
|
||||
@@ -251,6 +257,9 @@ class TestNetworkPolicyScenario(base.BaseKuryrScenarioTest):
|
||||
|
||||
@decorators.idempotent_id('47f0e412-3e13-40b2-93e5-503790df870b')
|
||||
def test_create_knp_crd_with_networkpolicy_spec_wrong_type(self):
|
||||
if not CONF.kuryr_kubernetes.validate_crd:
|
||||
raise self.skipException('CRD validation must be enabled to run '
|
||||
'this test.')
|
||||
np_name = 'test'
|
||||
knp_obj = dict(self._get_knp_obj(np_name))
|
||||
knp_obj['spec']['networkpolicy_spec'] = []
|
||||
|
||||
Reference in New Issue
Block a user