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:
@@ -4519,9 +4519,9 @@ class TestObjectController(unittest.TestCase):
|
|||||||
|
|
||||||
def _gather_x_container_headers(self, controller_call, req, *connect_args,
|
def _gather_x_container_headers(self, controller_call, req, *connect_args,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
header_list = kwargs.pop('header_list', ['X-Container-Partition',
|
header_list = kwargs.pop('header_list', ['X-Container-Device',
|
||||||
'X-Container-Host',
|
'X-Container-Host',
|
||||||
'X-Container-Device'])
|
'X-Container-Partition'])
|
||||||
seen_headers = []
|
seen_headers = []
|
||||||
|
|
||||||
def capture_headers(ipaddr, port, device, partition, method,
|
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
|
# don't care about the account/container HEADs, so chuck
|
||||||
# the first two requests
|
# the first two requests
|
||||||
return sorted(seen_headers[2:],
|
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):
|
def test_PUT_x_container_headers_with_equal_replicas(self):
|
||||||
req = Request.blank('/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
|
Reference in New Issue
Block a user