From 66a21c622937f7a2fc05caa75714a90ad1d82be0 Mon Sep 17 00:00:00 2001 From: Ravi Pradhan Date: Tue, 5 Nov 2024 11:12:56 +0000 Subject: [PATCH] feat: DBTP-1431 Add validation for CDN timeout (#609) Co-authored-by: Anthony Roy <81255001+antroy-madetech@users.noreply.github.com> --- dbt_platform_helper/utils/validation.py | 1 + .../utils/fixtures/addons_files/alb_addons.yml | 1 + .../utils/fixtures/addons_files/alb_addons_bad_data.yml | 7 +++++++ tests/platform_helper/utils/test_validation.py | 1 + 4 files changed, 10 insertions(+) diff --git a/dbt_platform_helper/utils/validation.py b/dbt_platform_helper/utils/validation.py index be18c30fd..649ac6cb3 100644 --- a/dbt_platform_helper/utils/validation.py +++ b/dbt_platform_helper/utils/validation.py @@ -403,6 +403,7 @@ def iam_role_arn_regex(key): Optional("cdn_geo_restriction_type"): str, Optional("cdn_logging_bucket"): str, Optional("cdn_logging_bucket_prefix"): str, + Optional("cdn_timeout_seconds"): int, Optional("default_waf"): str, Optional("domain_prefix"): str, Optional("enable_logging"): bool, diff --git a/tests/platform_helper/utils/fixtures/addons_files/alb_addons.yml b/tests/platform_helper/utils/fixtures/addons_files/alb_addons.yml index c8e0e25fe..cf6f0ac2c 100644 --- a/tests/platform_helper/utils/fixtures/addons_files/alb_addons.yml +++ b/tests/platform_helper/utils/fixtures/addons_files/alb_addons.yml @@ -12,6 +12,7 @@ my-alb: cdn_geo_restriction_type: "whitelist" cdn_logging_bucket: "bucket-name" cdn_logging_bucket_prefix: "myprefix" + cdn_timeout_seconds: 60 default_waf: "waf_sentinel_012345678910_default" enable_logging: true forwarded_values_forward: "all" diff --git a/tests/platform_helper/utils/fixtures/addons_files/alb_addons_bad_data.yml b/tests/platform_helper/utils/fixtures/addons_files/alb_addons_bad_data.yml index 527e2e91f..bb612c6bf 100644 --- a/tests/platform_helper/utils/fixtures/addons_files/alb_addons_bad_data.yml +++ b/tests/platform_helper/utils/fixtures/addons_files/alb_addons_bad_data.yml @@ -33,6 +33,13 @@ my-alb-cdn-domain-list-be-a-dict: cdn_domains_list: 1234 # Should be a tuple +my-alb-cdn-timeout-seconds-should-be-an-int: + type: alb + environments: + dev: + cdn_timeout_seconds: "hello world" # Should be an int + + my-cdn-geo-locations-be-a-list: type: alb environments: diff --git a/tests/platform_helper/utils/test_validation.py b/tests/platform_helper/utils/test_validation.py index e683413d4..12c706d12 100644 --- a/tests/platform_helper/utils/test_validation.py +++ b/tests/platform_helper/utils/test_validation.py @@ -243,6 +243,7 @@ def test_validate_addons_success(mock_name_is_available, addons_file): "my-alb-cdn-geo-restrictions-type-should-be-a-string": r"environments.*dev.*should be instance of 'str'", "my-alb-cdn-logging-bucket-should-be-a-string": r"environments.*dev.*should be instance of 'str'", "my-alb-cdn-logging-bucket-prefix-should-be-a-string": r"environments.*dev.*should be instance of 'str'", + "my-alb-cdn-timeout-seconds-should-be-an-int": r"environments.*dev.*should be instance of 'int'", "my-alb-default-waf-should-be-a-string": r"environments.*dev.*should be instance of 'str'", "my-alb-enable-logging-should-be-a-bool": r"environments.*dev.*should be instance of 'bool'", "my-alb-forwarded-values-forward-should-be-a-string": r"environments.*dev.*should be instance of 'str'",