From 1333b9e3357b61f6d42600b1affe308fbcfdd2e5 Mon Sep 17 00:00:00 2001 From: Alper Akanser Date: Thu, 19 Aug 2021 10:48:44 -0500 Subject: [PATCH] CDPCAM-69: skip CDP CIDR validation if tunnel enabled (#16) * CDPCAM-69: skip CDP CIDR validation if tunnel enabled Signed-off-by: Alper Akanser --- cdpctl/validation/conftest.py | 4 +- .../infra/validate_aws_security_groups.py | 2 + pytest.ini | 1 + pytests.ini | 44 ------------------- 4 files changed, 6 insertions(+), 45 deletions(-) delete mode 100644 pytests.ini diff --git a/cdpctl/validation/conftest.py b/cdpctl/validation/conftest.py index 586226a..888d267 100644 --- a/cdpctl/validation/conftest.py +++ b/cdpctl/validation/conftest.py @@ -187,7 +187,9 @@ def pytest_runtest_setup(item): and requested_config_value is not None ): config_value = get_config_value( - config=configuration, key=requested_config_value_path + config=configuration, + key=requested_config_value_path, + key_value_expected=False, ) if config_value is not None and config_value != requested_config_value: pytest.skip( diff --git a/cdpctl/validation/infra/validate_aws_security_groups.py b/cdpctl/validation/infra/validate_aws_security_groups.py index 20566c6..cb50999 100644 --- a/cdpctl/validation/infra/validate_aws_security_groups.py +++ b/cdpctl/validation/infra/validate_aws_security_groups.py @@ -73,6 +73,7 @@ def tunnel_enabled(config: Dict[str, Any]): @pytest.mark.aws @pytest.mark.infra +@pytest.mark.config_value(path="env:tunnel", value=False) def aws_default_security_groups_contains_cdp_cidr_validation( config: Dict[str, Any], cdp_cidrs: List[str], @@ -134,6 +135,7 @@ def _aws_default_security_groups_contains_cdp_cidr_validation( @pytest.mark.aws @pytest.mark.infra +@pytest.mark.config_value(path="env:tunnel", value=False) def aws_gateway_security_groups_contains_cdp_cidr_validation( config: Dict[str, Any], cdp_cidrs: List[str], diff --git a/pytest.ini b/pytest.ini index 575efd3..1bb63d9 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,4 +2,5 @@ markers = aws infra + config_value norecursedirs = cdpctl/validation/* diff --git a/pytests.ini b/pytests.ini deleted file mode 100644 index 4abbd75..0000000 --- a/pytests.ini +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding:utf-8 -*- -### -# CLOUDERA CDP Control (cdpctl) -# -# (C) Cloudera, Inc. 2021-2021 -# All rights reserved. -# -# Applicable Open Source License: GNU AFFERO GENERAL PUBLIC LICENSE -# -# NOTE: Cloudera open source products are modular software products -# made up of hundreds of individual components, each of which was -# individually copyrighted. Each Cloudera open source product is a -# collective work under U.S. Copyright Law. Your license to use the -# collective work is as provided in your written agreement with -# Cloudera. Used apart from the collective work, this file is -# licensed for your use pursuant to the open source license -# identified above. -# -# This code is provided to you pursuant a written agreement with -# (i) Cloudera, Inc. or (ii) a third-party authorized to distribute -# this code. If you do not have a written agreement with Cloudera nor -# with an authorized and properly licensed third party, you do not -# have any rights to access nor to use this code. -# -# Absent a written agreement with Cloudera, Inc. (“Cloudera”) to the -# contrary, A) CLOUDERA PROVIDES THIS CODE TO YOU WITHOUT WARRANTIES OF ANY -# KIND; (B) CLOUDERA DISCLAIMS ANY AND ALL EXPRESS AND IMPLIED -# WARRANTIES WITH RESPECT TO THIS CODE, INCLUDING BUT NOT LIMITED TO -# IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND -# FITNESS FOR A PARTICULAR PURPOSE; (C) CLOUDERA IS NOT LIABLE TO YOU, -# AND WILL NOT DEFEND, INDEMNIFY, NOR HOLD YOU HARMLESS FOR ANY CLAIMS -# ARISING FROM OR RELATED TO THE CODE; AND (D)WITH RESPECT TO YOUR EXERCISE -# OF ANY RIGHTS GRANTED TO YOU FOR THE CODE, CLOUDERA IS NOT LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR -# CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, DAMAGES -# RELATED TO LOST REVENUE, LOST PROFITS, LOSS OF INCOME, LOSS OF -# BUSINESS ADVANTAGE OR UNAVAILABILITY, OR LOSS OR CORRUPTION OF -# DATA. -# -# Source File Name: pytests.ini -[pytest] -markers = - aws - infra