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 test_infra/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ aws-cdk.aws_logs>=1.106.1
aws-cdk.aws_s3>=1.106.1
aws-cdk.aws_redshift>=1.106.1
aws-cdk.aws_rds>=1.106.1
aws_cdk.aws_secretsmanager>=1.106.1
aws_cdk.aws_secretsmanager>=1.106.1
aws_cdk.aws_ssm>=1.106.1
1 change: 1 addition & 0 deletions test_infra/stacks/base_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self, scope: cdk.Construct, construct_id: str, **kwargs: str) -> No
enable_dns_hostnames=True,
enable_dns_support=True,
)
cdk.Tags.of(self.vpc).add("Name", "aws-data-wrangler")
self.key = kms.Key(
self,
id="aws-data-wrangler-key",
Expand Down
29 changes: 18 additions & 11 deletions test_infra/stacks/databases_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from aws_cdk import aws_rds as rds
from aws_cdk import aws_redshift as redshift
from aws_cdk import aws_s3 as s3
from aws_cdk import aws_secretsmanager as ssm
from aws_cdk import aws_secretsmanager as secrets
from aws_cdk import aws_ssm as ssm
from aws_cdk import core as cdk


Expand Down Expand Up @@ -41,11 +42,11 @@ def __init__(
def _set_db_infra(self) -> None:
self.db_username = "test"
# fmt: off
self.db_password_secret = ssm.Secret(
self.db_password_secret = secrets.Secret(
self,
"db-password-secret",
secret_name="aws-data-wrangler/db_password",
generate_secret_string=ssm.SecretStringGenerator(exclude_characters="/@\"\' \\"),
generate_secret_string=secrets.SecretStringGenerator(exclude_characters="/@\"\' \\"),
).secret_value
# fmt: on
self.db_password = self.db_password_secret.to_string()
Expand All @@ -56,6 +57,12 @@ def _set_db_infra(self) -> None:
description="AWS Data Wrangler Test Arena - Database security group",
)
self.db_security_group.add_ingress_rule(ec2.Peer.any_ipv4(), ec2.Port.all_traffic())
ssm.StringParameter(
self,
"db-secruity-group-parameter",
parameter_name="/Wrangler/EC2/DatabaseSecurityGroupId",
string_value=self.db_security_group.security_group_id,
)
self.rds_subnet_group = rds.SubnetGroup(
self,
"aws-data-wrangler-rds-subnet-group",
Expand Down Expand Up @@ -225,12 +232,12 @@ def _setup_redshift(self) -> None:
subnet=self.vpc.private_subnets[0],
security_groups=[self.db_security_group],
)
ssm.Secret(
secrets.Secret(
self,
"aws-data-wrangler-redshift-secret",
secret_name="aws-data-wrangler/redshift",
description="Redshift credentials",
generate_secret_string=ssm.SecretStringGenerator(
generate_secret_string=secrets.SecretStringGenerator(
generate_string_key="dummy",
secret_string_template=json.dumps(
{
Expand Down Expand Up @@ -308,12 +315,12 @@ def _setup_postgresql(self) -> None:
subnet=self.vpc.private_subnets[0],
security_groups=[self.db_security_group],
)
ssm.Secret(
secrets.Secret(
self,
"aws-data-wrangler-postgresql-secret",
secret_name="aws-data-wrangler/postgresql",
description="Postgresql credentials",
generate_secret_string=ssm.SecretStringGenerator(
generate_secret_string=secrets.SecretStringGenerator(
generate_string_key="dummy",
secret_string_template=json.dumps(
{
Expand Down Expand Up @@ -392,12 +399,12 @@ def _setup_mysql(self) -> None:
subnet=self.vpc.private_subnets[0],
security_groups=[self.db_security_group],
)
ssm.Secret(
secrets.Secret(
self,
"aws-data-wrangler-mysql-secret",
secret_name="aws-data-wrangler/mysql",
description="MySQL credentials",
generate_secret_string=ssm.SecretStringGenerator(
generate_secret_string=secrets.SecretStringGenerator(
generate_string_key="dummy",
secret_string_template=json.dumps(
{
Expand Down Expand Up @@ -453,12 +460,12 @@ def _setup_sqlserver(self) -> None:
subnet=self.vpc.private_subnets[0],
security_groups=[self.db_security_group],
)
ssm.Secret(
secrets.Secret(
self,
"aws-data-wrangler-sqlserver-secret",
secret_name="aws-data-wrangler/sqlserver",
description="SQL Server credentials",
generate_secret_string=ssm.SecretStringGenerator(
generate_secret_string=secrets.SecretStringGenerator(
generate_string_key="dummy",
secret_string_template=json.dumps(
{
Expand Down
6 changes: 4 additions & 2 deletions tests/test_moto.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ def moto_subnet():
@pytest.fixture(scope="function")
def moto_s3():
with moto.mock_s3():
s3 = boto3.resource("s3")
s3.create_bucket(Bucket="bucket")
s3 = boto3.resource("s3", region_name="us-east-1")
s3.create_bucket(
Bucket="bucket",
)
yield s3


Expand Down