]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
s3tests: Add test_object_requestid_on_error
authorJavier M. Mellid <jmunhoz@igalia.com>
Wed, 9 Sep 2015 19:28:32 +0000 (21:28 +0200)
committerJavier M. Mellid <jmunhoz@igalia.com>
Wed, 28 Oct 2015 22:55:45 +0000 (23:55 +0100)
Error responses must contains a RequestId tag. This is the ID of the
request associated with the error.

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

index 41bc72cc88947f55092bb6fb3f98add855a7c087..a59a76c84397d71ed50ad491f0b3e8767102d428 100644 (file)
@@ -23,6 +23,7 @@ import threading
 import itertools
 import string
 import random
+import re
 
 import xml.etree.ElementTree as ET
 
@@ -832,6 +833,16 @@ def test_object_read_notexist():
     eq(e.reason, 'Not Found')
     eq(e.error_code, 'NoSuchKey')
 
+@attr(resource='object')
+@attr(method='get')
+@attr(operation='read contents that were never written to raise one error response')
+@attr(assertion='RequestId appears in the error response')
+def test_object_requestid_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(0)
+    assert request_id is not None
 
 @attr(resource='object')
 @attr(method='put')