From b6185d2924b9584908766068f2ef5b91ca9dc6bd Mon Sep 17 00:00:00 2001 From: jillr Date: Thu, 20 May 2021 22:32:03 +0000 Subject: [PATCH] Use md5 hashes for unique prefixes instead of shippable regex --- tests/integration/targets/aws_codebuild/defaults/main.yml | 7 ++----- .../integration/targets/aws_codepipeline/defaults/main.yml | 7 ++----- tests/integration/targets/ec2_eip/defaults/main.yml | 4 ++-- tests/integration/targets/lambda/defaults/main.yml | 7 ++----- tests/integration/targets/lambda_alias/defaults/main.yml | 7 ++----- tests/integration/targets/lambda_policy/defaults/main.yml | 7 ++----- .../targets/s3_bucket_notification/defaults/main.yml | 7 ++----- tests/integration/targets/sns_topic/defaults/main.yml | 7 ++----- 8 files changed, 16 insertions(+), 37 deletions(-) diff --git a/tests/integration/targets/aws_codebuild/defaults/main.yml b/tests/integration/targets/aws_codebuild/defaults/main.yml index a36eb3de720..8887815ff93 100644 --- a/tests/integration/targets/aws_codebuild/defaults/main.yml +++ b/tests/integration/targets/aws_codebuild/defaults/main.yml @@ -2,9 +2,6 @@ # defaults file for aws_codebuild # IAM role names have to be less than 64 characters -# The 8 digit identifier at the end of resource_prefix helps determine during -# which test something was created and allows tests to be run in parallel -# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases -# we need both sets of digits to keep the resource name unique -unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}" +# we hash the resource_prefix to get a shorter, unique string +unique_id: "{{ resource_prefix | hash('md5') }}" iam_role_name: "ansible-test-sts-{{ unique_id }}-codebuild-service-role" diff --git a/tests/integration/targets/aws_codepipeline/defaults/main.yml b/tests/integration/targets/aws_codepipeline/defaults/main.yml index 5f735ba6df9..1b444306532 100644 --- a/tests/integration/targets/aws_codepipeline/defaults/main.yml +++ b/tests/integration/targets/aws_codepipeline/defaults/main.yml @@ -4,9 +4,6 @@ codepipeline_name: "{{ resource_prefix }}-test-codepipeline" # IAM role names have to be less than 64 characters -# The 8 digit identifier at the end of resource_prefix helps determine during -# which test something was created and allows tests to be run in parallel -# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases -# we need both sets of digits to keep the resource name unique -unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}" +# we hash the resource_prefix to get a shorter, unique string +unique_id: "{{ resource_prefix | hash('md5') }}" codepipeline_service_role_name: "ansible-test-sts-{{ unique_id }}-codepipeline-role" diff --git a/tests/integration/targets/ec2_eip/defaults/main.yml b/tests/integration/targets/ec2_eip/defaults/main.yml index 8986714b6c8..bbaeb04820c 100644 --- a/tests/integration/targets/ec2_eip/defaults/main.yml +++ b/tests/integration/targets/ec2_eip/defaults/main.yml @@ -1,5 +1,5 @@ --- -# VPCs are identified by the CIDR. Don't hard code the CIDR. shippable will -# run multiple copies of the test concurrently (Python 2.x and Python 3.x) +# VPCs are identified by the CIDR. Don't hard code the CIDR. CI may +# run multiple copies of the test concurrently. vpc_cidr: '10.{{ 256 | random(seed=resource_prefix) }}.0.0/16' subnet_cidr: '10.{{ 256 | random(seed=resource_prefix) }}.42.0/24' diff --git a/tests/integration/targets/lambda/defaults/main.yml b/tests/integration/targets/lambda/defaults/main.yml index ea29794efe0..6ddc88d7198 100644 --- a/tests/integration/targets/lambda/defaults/main.yml +++ b/tests/integration/targets/lambda/defaults/main.yml @@ -2,9 +2,6 @@ # defaults file for lambda integration test lambda_function_name: '{{ resource_prefix }}' # IAM role names have to be less than 64 characters -# The 8 digit identifier at the end of resource_prefix helps determine during -# which test something was created and allows tests to be run in parallel -# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases -# we need both sets of digits to keep the resource name unique -unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}" +# we hash the resource_prefix to get a shorter, unique string +unique_id: "{{ resource_prefix | hash('md5') }}" lambda_role_name: 'ansible-test-{{ unique_id }}-lambda' diff --git a/tests/integration/targets/lambda_alias/defaults/main.yml b/tests/integration/targets/lambda_alias/defaults/main.yml index ea29794efe0..6ddc88d7198 100644 --- a/tests/integration/targets/lambda_alias/defaults/main.yml +++ b/tests/integration/targets/lambda_alias/defaults/main.yml @@ -2,9 +2,6 @@ # defaults file for lambda integration test lambda_function_name: '{{ resource_prefix }}' # IAM role names have to be less than 64 characters -# The 8 digit identifier at the end of resource_prefix helps determine during -# which test something was created and allows tests to be run in parallel -# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases -# we need both sets of digits to keep the resource name unique -unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}" +# we hash the resource_prefix to get a shorter, unique string +unique_id: "{{ resource_prefix | hash('md5') }}" lambda_role_name: 'ansible-test-{{ unique_id }}-lambda' diff --git a/tests/integration/targets/lambda_policy/defaults/main.yml b/tests/integration/targets/lambda_policy/defaults/main.yml index 5bcb2027367..2919b66e77a 100644 --- a/tests/integration/targets/lambda_policy/defaults/main.yml +++ b/tests/integration/targets/lambda_policy/defaults/main.yml @@ -2,9 +2,6 @@ # defaults file for lambda_policy integration test lambda_function_name: '{{ resource_prefix }}-api-endpoint' # IAM role names have to be less than 64 characters -# The 8 digit identifier at the end of resource_prefix helps determine during -# which test something was created and allows tests to be run in parallel -# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases -# we need both sets of digits to keep the resource name unique -unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}" +# we hash the resource_prefix to get a shorter, unique string +unique_id: "{{ resource_prefix | hash('md5') }}" lambda_role_name: 'ansible-test-{{ unique_id }}-lambda-policy' diff --git a/tests/integration/targets/s3_bucket_notification/defaults/main.yml b/tests/integration/targets/s3_bucket_notification/defaults/main.yml index ad2a4c68f0c..2c109612bcb 100644 --- a/tests/integration/targets/s3_bucket_notification/defaults/main.yml +++ b/tests/integration/targets/s3_bucket_notification/defaults/main.yml @@ -2,9 +2,6 @@ # defaults file for s3_bucket_notifications integration test lambda_function_name: '{{ resource_prefix }}' # IAM role names have to be less than 64 characters -# The 8 digit identifier at the end of resource_prefix helps determine during -# which test something was created and allows tests to be run in parallel -# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases -# we need both sets of digits to keep the resource name unique -unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}" +# we hash the resource_prefix to get a shorter, unique string +unique_id: "{{ resource_prefix | hash('md5') }}" lambda_role_name: 'ansible-test-{{ unique_id }}-s3-notifications' diff --git a/tests/integration/targets/sns_topic/defaults/main.yml b/tests/integration/targets/sns_topic/defaults/main.yml index 4082236c73b..19d84a3c5ea 100644 --- a/tests/integration/targets/sns_topic/defaults/main.yml +++ b/tests/integration/targets/sns_topic/defaults/main.yml @@ -7,9 +7,6 @@ sns_topic_third_party_region: "{{ sns_topic_third_party_topic_arn.split(':')[3] sns_topic_lambda_function: "sns_topic_lambda" sns_topic_lambda_name: "{{ resource_prefix }}-{{ sns_topic_lambda_function }}" # IAM role names have to be less than 64 characters -# The 8 digit identifier at the end of resource_prefix helps determine during -# which test something was created and allows tests to be run in parallel -# Shippable resource_prefixes are in the format shippable-123456-123, so in those cases -# we need both sets of digits to keep the resource name unique -unique_id: "{{ resource_prefix | regex_search('(\\d+-?)(\\d+)$') }}" +# we hash the resource_prefix to get a shorter, unique string +unique_id: "{{ resource_prefix | hash('md5') }}" sns_topic_lambda_role: "ansible-test-{{ unique_id }}-sns-lambda"