Fix a pagination logic bug in test_bug_1689692

This test attempts to list all instances, then list them again with the
first instance as the marker and ensure that the remaining instances
are returned in the page. Now that we are doing queries to cells in
parallel, consecutive unsorted list queries can return things in
different orders as the cells may reply at different times. The fix
in this patch is to ask for results to be sorted, which is the only way
it makes sense. It worked before purely because we were always scanning
the cells linearly and in the same order.

Related-Bug: #1689692
Change-Id: I3ca2a167c902d565c36a5d5dbba1bf1c214aa20b
This commit is contained in:
Dan Smith 2017-09-20 07:20:32 -07:00
parent 3e37c2e10e
commit affb25ecef
1 changed files with 3 additions and 2 deletions

View File

@ -71,13 +71,14 @@ class ServerListLimitMarkerCell0Test(test.TestCase,
self.addCleanup(self.api.delete_server, server['id'])
self._wait_for_state_change(self.api, server, 'ERROR')
servers = self.api.get_servers()
servers = self.api.get_servers(search_opts=dict(sort_key='uuid'))
self.assertEqual(3, len(servers))
# Take the first server and user that as our marker.
marker = servers[0]['id']
# Since we're paging after the first server as our marker, there are
# only two left so specifying three should just return two.
servers = self.api.get_servers(search_opts=dict(marker=marker,
servers = self.api.get_servers(search_opts=dict(sort_key='uuid',
marker=marker,
limit=3))
self.assertEqual(2, len(servers))