diff options
author | Tim Burke <tim.burke@gmail.com> | 2023-03-14 11:52:50 -0700 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2023-03-15 12:37:02 -0700 |
commit | e3432982405a8446ca2c7384334fa9c6d10a6271 (patch) | |
tree | 7bc57aa61a4393b313c92d44b79457c1aa87604e /test | |
parent | d572ccfae9328e205a39559f2f83ed5c844231c5 (diff) | |
download | python-swiftclient-e3432982405a8446ca2c7384334fa9c6d10a6271.tar.gz |
Include transaction ID on content-check failures
Change-Id: I6b667db26ffc5dccdcadfc8c73f7accb81f03dac
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/test_service.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/unit/test_service.py b/test/unit/test_service.py index b6db22d..cdab61f 100644 --- a/test/unit/test_service.py +++ b/test/unit/test_service.py @@ -201,7 +201,19 @@ class TestSwiftReader(unittest.TestCase): with self.assertRaises(SwiftError) as cm: _consume(sr) self.assertEqual( - "'Error downloading path: read_length != content_length, 4 != 5'", + "'Error downloading path: read_length != content_length, " + "4 != 5 (txn: unknown)'", + str(cm.exception)) + + # Check error includes txn id if available + sr = self.sr('path', BytesIO(b'body'), {'content-length': 5, + 'etag': 'bad etag', + 'x-trans-id': 'uuid'}) + with self.assertRaises(SwiftError) as cm: + _consume(sr) + self.assertEqual( + "'Error downloading path: read_length != content_length, " + "4 != 5 (txn: uuid)'", str(cm.exception)) # Check error is raised if SwiftReader doesn't calculate the expected @@ -212,7 +224,7 @@ class TestSwiftReader(unittest.TestCase): _consume(sr) self.assertEqual( "'Error downloading path: md5sum != etag, " - "841a2d689ad86bd1611447453c22c6fc != bad etag'", + "841a2d689ad86bd1611447453c22c6fc != bad etag (txn: unknown)'", str(cm.exception)) sr = self.sr('path', BytesIO(b'body'), {'content-length': 4}) |