-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Dont use DNS style addressing for GetBucketLocation #380
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -532,5 +532,34 @@ def test_bucket_in_other_region_using_http(self): | |
self.keys.append('foo.txt') | ||
|
||
|
||
class TestGetBucketLocationForEUCentral1(BaseS3Test): | ||
def setUp(self): | ||
super(TestGetBucketLocationForEUCentral1, self).setUp() | ||
self.bucket_name = 'botocoretest%s-%s' % ( | ||
int(time.time()), random.randint(1, 1000)) | ||
endpoint = self.service.get_endpoint('eu-central-1') | ||
operation = self.service.get_operation('CreateBucket') | ||
response = operation.call(endpoint, bucket=self.bucket_name, | ||
create_bucket_configuration={'LocationConstraint': 'eu-central-1'}) | ||
self.assertEqual(response[0].status_code, 200) | ||
|
||
def tearDown(self): | ||
super(TestGetBucketLocationForEUCentral1, self).tearDown() | ||
endpoint = self.service.get_endpoint('eu-central-1') | ||
operation = self.service.get_operation('DeleteBucket') | ||
response = operation.call(endpoint, bucket=self.bucket_name) | ||
self.assertEqual(response[0].status_code, 204) | ||
|
||
def test_can_get_bucket_location(self): | ||
# Even though the bucket is in eu-central-1, we should still be able to | ||
# use the us-east-1 endpoint class to get the bucket location. | ||
operation = self.service.get_operation('GetBucketLocation') | ||
# Also keep in mind that while this test is useful, it doesn't test | ||
# what happens once DNS propogates which is arguably more interesting, | ||
# as DNS will point us to the eu-central-1 endpoint. | ||
response = operation.call(self.endpoint, Bucket=self.bucket_name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the endpoint region being used is "eu-central-1" still? I would like to see using different regions for endpoints. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not obvious from this test, but self.endpoint is actually the endpoint for us-east-1, defined in the base classes's setUp. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh my bad. I saw |
||
self.assertEqual(response[1]['LocationConstraint'], 'eu-central-1') | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should be using the clients instead of service and operation objects since we are trying to move toward clients.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah good point. I'll update what all the test fixture setup/teardown to use clients. I think we still need the service/operation in the actual tests themselves (in addition to the client interfaces) until we can actually deprecate the service/operation objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I figure that catching ourselves now, while we are adding more code, will save us time down the road when we make the switch.