Fix boto/boto3 multi-param discrepancies
boto uses the param.member.N syntax, but boto3 replaces the generic .member with a more specific identifier. Example: boto: ClusterSecurityGroups.member.N boto3: ClusterSecurityGroups.ClusterSecurityGroupName.N This commit addresses this issue for the ClusterSecurityGroups, SubnetIds, and VpcSecurityGroupIds parameters.
This commit is contained in:
parent
5bb6b98f6d
commit
ab595279ad
2 changed files with 77 additions and 19 deletions
|
|
@ -216,6 +216,33 @@ def test_create_cluster_with_security_group():
|
|||
set(group_names).should.equal(set(["security_group1", "security_group2"]))
|
||||
|
||||
|
||||
@mock_redshift
|
||||
def test_create_cluster_with_security_group_boto3():
|
||||
client = boto3.client('redshift', region_name='us-east-1')
|
||||
client.create_cluster_security_group(
|
||||
ClusterSecurityGroupName="security_group1",
|
||||
Description="This is my security group",
|
||||
)
|
||||
client.create_cluster_security_group(
|
||||
ClusterSecurityGroupName="security_group2",
|
||||
Description="This is my security group",
|
||||
)
|
||||
|
||||
cluster_identifier = 'my_cluster'
|
||||
client.create_cluster(
|
||||
ClusterIdentifier=cluster_identifier,
|
||||
NodeType="dw.hs1.xlarge",
|
||||
MasterUsername="username",
|
||||
MasterUserPassword="password",
|
||||
ClusterSecurityGroups=["security_group1", "security_group2"]
|
||||
)
|
||||
response = client.describe_clusters(ClusterIdentifier=cluster_identifier)
|
||||
cluster = response['Clusters'][0]
|
||||
group_names = [group['ClusterSecurityGroupName']
|
||||
for group in cluster['ClusterSecurityGroups']]
|
||||
set(group_names).should.equal({"security_group1", "security_group2"})
|
||||
|
||||
|
||||
@mock_redshift_deprecated
|
||||
@mock_ec2_deprecated
|
||||
def test_create_cluster_with_vpc_security_groups():
|
||||
|
|
@ -242,6 +269,31 @@ def test_create_cluster_with_vpc_security_groups():
|
|||
list(group_ids).should.equal([security_group.id])
|
||||
|
||||
|
||||
@mock_redshift
|
||||
@mock_ec2
|
||||
def test_create_cluster_with_vpc_security_groups_boto3():
|
||||
ec2 = boto3.resource('ec2', region_name='us-east-1')
|
||||
vpc = ec2.create_vpc(CidrBlock='10.0.0.0/16')
|
||||
client = boto3.client('redshift', region_name='us-east-1')
|
||||
cluster_id = 'my_cluster'
|
||||
security_group = ec2.create_security_group(
|
||||
Description="vpc_security_group",
|
||||
GroupName="a group",
|
||||
VpcId=vpc.id)
|
||||
client.create_cluster(
|
||||
ClusterIdentifier=cluster_id,
|
||||
NodeType="dw.hs1.xlarge",
|
||||
MasterUsername="username",
|
||||
MasterUserPassword="password",
|
||||
VpcSecurityGroupIds=[security_group.id],
|
||||
)
|
||||
response = client.describe_clusters(ClusterIdentifier=cluster_id)
|
||||
cluster = response['Clusters'][0]
|
||||
group_ids = [group['VpcSecurityGroupId']
|
||||
for group in cluster['VpcSecurityGroups']]
|
||||
list(group_ids).should.equal([security_group.id])
|
||||
|
||||
|
||||
@mock_redshift_deprecated
|
||||
def test_create_cluster_with_parameter_group():
|
||||
conn = boto.connect_redshift()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue