]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
s3tests: Add test_object_requestid_matchs_header_on_error 76/head
authorJavier M. Mellid <jmunhoz@igalia.com>
Wed, 9 Sep 2015 19:49:17 +0000 (21:49 +0200)
committerJavier M. Mellid <jmunhoz@igalia.com>
Wed, 28 Oct 2015 23:12:51 +0000 (00:12 +0100)
Error responses' RequestId must match header's x-amz-request-id value.

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
s3tests/functional/test_s3.py

index a59a76c84397d71ed50ad491f0b3e8767102d428..08fa75726294d62f3882da6ea6e01b2bb6ac822c 100644 (file)
@@ -844,6 +844,17 @@ def test_object_requestid_on_error():
     request_id = re.search(r'<RequestId>.*</RequestId>', e.body.encode('utf-8')).group(0)
     assert request_id is not None
 
+@attr(resource='object')
+@attr(method='get')
+@attr(operation='read contents that were never written to raise one error response')
+@attr(assertion='RequestId in the error response matchs the x-amz-request-id in the headers')
+def test_object_requestid_matchs_header_on_error():
+    bucket = get_new_bucket()
+    key = bucket.new_key('foobar')
+    e = assert_raises(boto.exception.S3ResponseError, key.get_contents_as_string)
+    request_id = re.search(r'<RequestId>(.*)</RequestId>', e.body.encode('utf-8')).group(1)
+    eq(key.resp.getheader('x-amz-request-id'), request_id)
+
 @attr(resource='object')
 @attr(method='put')
 @attr(operation='write to special characters key')