Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moto not throw ClientError that difference with boto3 when create_route with existing route #5187

Closed
louiske0911 opened this issue Jun 2, 2022 · 3 comments · Fixed by #5233

Comments

@louiske0911
Copy link

louiske0911 commented Jun 2, 2022

How to reproduce the issue

  1. CreateRoute
self.__client.create_route(DestinationCidrBlock="10.0.0.0/16",
                                                  VpcPeeringConnectionId="pcx-03320a45231ea87fd",
                                                  RouteTableId="rtb-089c30716c0509cb2")
  1. CreateRoute with the already existing route
self.__client.create_route(DestinationCidrBlock="10.0.0.0/16",
                                                  VpcPeeringConnectionId="pcx-03320a45231ea87fd",
                                                  RouteTableId="rtb-089c30716c0509cb2")

What you expected to happen

Throw the exception in boto3 without mock

{
	'Error': {
		'Code': 'RouteAlreadyExists',
		'Message': 'Therouteidentifiedby10.0.0.0/16alreadyexists.'
	},
	'ResponseMetadata': {
		'RequestId': 'de503fae-1bd4-4678-9885-0d568ad21bf3',
		'HTTPStatusCode': 400,
		'HTTPHeaders': {
			'x-amzn-requestid': 'de503fae-1bd4-4678-9885-0d568ad21bf3',
			'cache-control': 'no-cache,
			no-store',
			'strict-transport-security': 'max-age=31536000;includeSubDomains',
			'vary': 'accept-encoding',
			'content-type': 'text/xml;charset=UTF-8',
			'transfer-encoding': 'chunked',
			'date': 'Thu,
			02Jun202212: 37: 49GMT',
			'connection': 'close',
			'server': 'AmazonEC2'
		},
		'RetryAttempts': 0
	}
}

What actually happens

Not have any exception with moto

{
	'Return': True,
	'ResponseMetadata': {
		'RequestId': '59dbff89-35bd-4eac-99ed-be587EXAMPLE',
		'HTTPStatusCode': 200,
		'HTTPHeaders': {
			'server': 'amazon.com'
		},
		'RetryAttempts': 0
	}
}

What version of Moto you're using

boto3==1.24.1
botocore==1.27.1
moto==3.1.11

Not sure do I need to use another version of the moto?

@bblommers
Copy link
Collaborator

Looks like we haven't implemented that validation yet. Thanks for raising this and providing the expected error @louiske0911!

@mmerrill3
Copy link
Contributor

Does the existing function also account for network overlaps? It would be an overlap check that produces this error, not just an exact match on the CIDR, right?

@mmerrill3
Copy link
Contributor

@bblommers assign to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants