Merge "Fix marker pagination for /servers"

This commit is contained in:
Jenkins 2012-09-20 02:13:30 +00:00 committed by Gerrit Code Review
commit 1d70b53ba8
2 changed files with 12 additions and 3 deletions

View File

@ -1067,6 +1067,10 @@ class InstanceNotFound(NotFound):
message = _("Instance %(instance_id)s could not be found.")
class MarkerNotFound(NotFound):
message = _("Marker %(marker)s could not be found.")
class InvalidInstanceIDMalformed(Invalid):
message = _("Invalid id: %(val)s (expecting \"i-...\").")

View File

@ -126,19 +126,24 @@ class DbApiTestCase(test.TestCase):
result = db.instance_get_all_by_filters(self.context,
{'display_name': '%test%'},
sort_dir="asc",
marker=test1)
marker=test1['uuid'])
self.assertEqual(2, len(result))
result = db.instance_get_all_by_filters(self.context,
{'display_name': '%test%'},
sort_dir="asc",
marker=test2)
marker=test2['uuid'])
self.assertEqual(1, len(result))
result = db.instance_get_all_by_filters(self.context,
{'display_name': '%test%'},
sort_dir="asc",
marker=test3)
marker=test3['uuid'])
self.assertEqual(0, len(result))
self.assertRaises(exception.MarkerNotFound,
db.instance_get_all_by_filters,
self.context, {'display_name': '%test%'},
marker=str(utils.gen_uuid()))
def test_migration_get_unconfirmed_by_dest_compute(self):
ctxt = context.get_admin_context()