Skip to content

Commit

Permalink
Fix emr endpoints for eu-central-1 and cn-north-1
Browse files Browse the repository at this point in the history
Added integration tests as an additional safety net here.
  • Loading branch information
jamesls committed Dec 29, 2014
1 parent f191181 commit 81eb10f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
8 changes: 7 additions & 1 deletion botocore/data/aws/_endpoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,17 @@
],
"elasticmapreduce":[
{
"uri":"https://cn-north-1.elasticmapreduce.amazonaws.com.cn",
"uri":"https://elasticmapreduce.cn-north-1.amazonaws.com.cn",
"constraints":[
["region", "startsWith", "cn-"]
]
},
{
"uri":"https://elasticmapreduce.eu-central-1.amazonaws.com",
"constraints":[
["region", "equals", "eu-central-1"]
]
},
{
"uri":"https://elasticmapreduce.us-east-1.amazonaws.com",
"constraints":[
Expand Down
20 changes: 20 additions & 0 deletions tests/integration/test_emr.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,30 @@
# language governing permissions and limitations under the License.
from tests import unittest

from nose.tools import assert_true

import botocore.session
from botocore.paginate import DeprecatedPageIterator


def test_emr_endpoints_work_with_py26():
# Verify that we can talk to all currently supported EMR endpoints.
# Python2.6 has an SSL cert bug where it can't read the SAN of
# certain SSL certs. We therefore need to always use the CN
# as the hostname.
session = botocore.session.get_session()
for region in ['us-east-1', 'us-west-2', 'us-west-2', 'ap-northeast-1',
'ap-southeast-1', 'ap-southeast-2', 'sa-east-1', 'eu-west-1',
'eu-central-1']:
yield _test_can_list_clusters_in_region, session, region


def _test_can_list_clusters_in_region(session, region):
client = session.create_client('emr', region_name=region)
response = client.list_clusters()
assert_true('Clusters' in response)


# I consider these integration tests because they're
# testing more than a single unit, we're ensuring everything
# accessible from the session works as expected.
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
"monitoring": "monitoring.cn-north-1.amazonaws.com.cn",
"dynamodb": "dynamodb.cn-north-1.amazonaws.com.cn",
"ec2": "ec2.cn-north-1.amazonaws.com.cn",
"elasticmapreduce": "cn-north-1.elasticmapreduce.amazonaws.com.cn",
"elasticmapreduce": "elasticmapreduce.cn-north-1.amazonaws.com.cn",
"elasticache": "elasticache.cn-north-1.amazonaws.com.cn",
"rds": "rds.cn-north-1.amazonaws.com.cn",
"sns": "sns.cn-north-1.amazonaws.com.cn",
Expand Down Expand Up @@ -284,6 +284,9 @@
"fips-us-gov-west-1": {
"s3": "s3-fips-us-gov-west-1.amazonaws.com"
},
"eu-central-1": {
"elasticmapreduce": "elasticmapreduce.eu-central-1.amazonaws.com",
}
}

def test_known_endpoints():
Expand Down

0 comments on commit 81eb10f

Please sign in to comment.