Fix flaky test.

test_DELETE_x_container_headers_with_more_container_replicas() would
sometimes fail, and it's because a test helper method was defaulting
to sorting the captured headers by X-Container-Partition. Well, in
tests we use FakeRing, and the partition is always 1, so that sorting
didn't buy us much. Now the sorting is done by X-Container-Device,
which actually differs meaningfully.

Change-Id: Ibe5b2fcd3f23280ed2caaa703111a98861331866
This commit is contained in:
Samuel Merritt 2013-07-03 17:45:20 -07:00
parent 7bb1d07cd0
commit 151313ba8c
1 changed files with 3 additions and 3 deletions

View File

@ -4519,9 +4519,9 @@ class TestObjectController(unittest.TestCase):
def _gather_x_container_headers(self, controller_call, req, *connect_args,
**kwargs):
header_list = kwargs.pop('header_list', ['X-Container-Partition',
header_list = kwargs.pop('header_list', ['X-Container-Device',
'X-Container-Host',
'X-Container-Device'])
'X-Container-Partition'])
seen_headers = []
def capture_headers(ipaddr, port, device, partition, method,
@ -4542,7 +4542,7 @@ class TestObjectController(unittest.TestCase):
# don't care about the account/container HEADs, so chuck
# the first two requests
return sorted(seen_headers[2:],
key=lambda d: d.get(header_list[0]) or 'Z')
key=lambda d: d.get(header_list[0]) or 'z')
def test_PUT_x_container_headers_with_equal_replicas(self):
req = Request.blank('/a/c/o', environ={'REQUEST_METHOD': 'PUT'},