diff --git a/tests/integration/pipeline/base.py b/tests/integration/pipeline/base.py index 60b4705a55..6fc027266b 100644 --- a/tests/integration/pipeline/base.py +++ b/tests/integration/pipeline/base.py @@ -51,12 +51,13 @@ def get_init_command_list( class BootstrapIntegBase(PipelineBase): + region = "us-east-1" stack_names: List[str] cf_client: Any @classmethod def setUpClass(cls): - cls.cf_client = boto3.client("cloudformation") + cls.cf_client = boto3.client("cloudformation", region_name=cls.region) def setUp(self): self.stack_names = [] diff --git a/tests/integration/pipeline/test_bootstrap_command.py b/tests/integration/pipeline/test_bootstrap_command.py index e3c39e4a48..43b5729e16 100644 --- a/tests/integration/pipeline/test_bootstrap_command.py +++ b/tests/integration/pipeline/test_bootstrap_command.py @@ -34,7 +34,7 @@ def test_interactive_with_no_resources_provided(self, create_image_repository): inputs = [ stage_name, CREDENTIAL_PROFILE, - "us-east-1", # region + self.region, # region "", # pipeline user "", # Pipeline execution role "", # CloudFormation execution role @@ -85,7 +85,10 @@ def test_non_interactive_with_no_resources_provided(self, create_image_repositor self.stack_names = [stack_name] bootstrap_command_list = self.get_bootstrap_command_list( - no_interactive=True, create_image_repository=create_image_repository, no_confirm_changeset=True + no_interactive=True, + create_image_repository=create_image_repository, + no_confirm_changeset=True, + region=self.region, ) bootstrap_process_execute = run_command(bootstrap_command_list) @@ -103,7 +106,7 @@ def test_interactive_with_all_required_resources_provided(self): inputs = [ stage_name, CREDENTIAL_PROFILE, - "us-east-1", # region + self.region, # region "arn:aws:iam::123:user/user-name", # pipeline user "arn:aws:iam::123:role/role-name", # Pipeline execution role "arn:aws:iam::123:role/role-name", # CloudFormation execution role @@ -130,6 +133,7 @@ def test_no_interactive_with_all_required_resources_provided(self): cloudformation_execution_role="arn:aws:iam::123:role/role-name", # CloudFormation execution role bucket="arn:aws:s3:::bucket-name", # Artifacts bucket image_repository="arn:aws:ecr:::repository/repo-name", # ecr repo + region=self.region, ) bootstrap_process_execute = run_command(bootstrap_command_list) @@ -152,6 +156,7 @@ def test_no_interactive_with_some_required_resources_provided(self, confirm_chan bucket="arn:aws:s3:::bucket-name", # Artifacts bucket image_repository="arn:aws:ecr:::repository/repo-name", # ecr repo no_confirm_changeset=not confirm_changeset, + region=self.region, ) inputs = [ @@ -174,7 +179,7 @@ def test_interactive_cancelled_by_user(self): inputs = [ stage_name, CREDENTIAL_PROFILE, - "us-east-1", # region + self.region, # region "arn:aws:iam::123:user/user-name", # pipeline user "arn:aws:iam::123:role/role-name", # Pipeline execution role "", # CloudFormation execution role @@ -200,7 +205,7 @@ def test_interactive_with_some_required_resources_provided(self): inputs = [ stage_name, CREDENTIAL_PROFILE, - "us-east-1", # region + self.region, # region "arn:aws:iam::123:user/user-name", # pipeline user "arn:aws:iam::123:role/role-name", # Pipeline execution role "", # CloudFormation execution role @@ -235,7 +240,7 @@ def test_interactive_pipeline_user_only_created_once(self): inputs = [ stage_name, CREDENTIAL_PROFILE, - "us-east-1", # region + self.region, # region *([""] if i == 0 else []), # pipeline user "arn:aws:iam::123:role/role-name", # Pipeline execution role "arn:aws:iam::123:role/role-name", # CloudFormation execution role @@ -268,7 +273,7 @@ def test_bootstrapped_buckets_accept_ssl_requests_only(self, bucket_logical_id): self.stack_names = [stack_name] bootstrap_command_list = self.get_bootstrap_command_list( - stage_name=stage_name, no_interactive=True, no_confirm_changeset=True + stage_name=stage_name, no_interactive=True, no_confirm_changeset=True, region=self.region ) bootstrap_process_execute = run_command(bootstrap_command_list) @@ -285,8 +290,8 @@ def test_bootstrapped_buckets_accept_ssl_requests_only(self, bucket_logical_id): bucket_key = "any/testing/key.txt" testing_data = b"any testing binary data" - s3_ssl_client = boto3.client("s3") - s3_non_ssl_client = boto3.client("s3", use_ssl=False) + s3_ssl_client = boto3.client("s3", region_name=self.region) + s3_non_ssl_client = boto3.client("s3", use_ssl=False, region_name=self.region) # Assert SSL requests are accepted s3_ssl_client.put_object(Body=testing_data, Bucket=bucket_name, Key=bucket_key) @@ -306,7 +311,7 @@ def test_bootstrapped_artifacts_bucket_has_server_access_log_enabled(self): self.stack_names = [stack_name] bootstrap_command_list = self.get_bootstrap_command_list( - stage_name=stage_name, no_interactive=True, no_confirm_changeset=True + stage_name=stage_name, no_interactive=True, no_confirm_changeset=True, region=self.region ) bootstrap_process_execute = run_command(bootstrap_command_list) @@ -327,6 +332,6 @@ def test_bootstrapped_artifacts_bucket_has_server_access_log_enabled(self): ) artifacts_logging_bucket_name = artifacts_logging_bucket["PhysicalResourceId"] - s3_client = boto3.client("s3") + s3_client = boto3.client("s3", region_name=self.region) res = s3_client.get_bucket_logging(Bucket=artifacts_bucket_name) self.assertEqual(artifacts_logging_bucket_name, res["LoggingEnabled"]["TargetBucket"])