Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/integration/pipeline/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
27 changes: 16 additions & 11 deletions tests/integration/pipeline/test_bootstrap_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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 = [
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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"])