Merge "Fix changes-since filter for list-servers API"
This commit is contained in:
commit
715c09a2bc
|
@ -1875,7 +1875,7 @@ def instance_get_all_by_filters(context, filters, sort_key, sort_dir,
|
|||
if 'changes-since' in filters:
|
||||
changes_since = timeutils.normalize_time(filters['changes-since'])
|
||||
query_prefix = query_prefix.\
|
||||
filter(models.Instance.updated_at > changes_since)
|
||||
filter(models.Instance.updated_at >= changes_since)
|
||||
|
||||
if 'deleted' in filters:
|
||||
# Instances can be soft or hard deleted and the query needs to
|
||||
|
|
|
@ -1518,6 +1518,23 @@ class InstanceTestCase(test.TestCase, ModelsObjectComparatorMixin):
|
|||
{'display_name': 't.*st.'})
|
||||
self._assertEqualListsOfInstances(result, [i1, i2])
|
||||
|
||||
def test_instance_get_all_by_filters_changes_since(self):
|
||||
i1 = self.create_instance_with_args(updated_at=
|
||||
'2013-12-05T15:03:25.000000')
|
||||
i2 = self.create_instance_with_args(updated_at=
|
||||
'2013-12-05T15:03:26.000000')
|
||||
changes_since = iso8601.parse_date('2013-12-05T15:03:25.000000')
|
||||
result = db.instance_get_all_by_filters(self.ctxt,
|
||||
{'changes-since':
|
||||
changes_since})
|
||||
self._assertEqualListsOfInstances([i1, i2], result)
|
||||
|
||||
changes_since = iso8601.parse_date('2013-12-05T15:03:26.000000')
|
||||
result = db.instance_get_all_by_filters(self.ctxt,
|
||||
{'changes-since':
|
||||
changes_since})
|
||||
self._assertEqualListsOfInstances([i2], result)
|
||||
|
||||
def test_instance_get_all_by_filters_exact_match(self):
|
||||
instance = self.create_instance_with_args(host='host1')
|
||||
self.create_instance_with_args(host='host12')
|
||||
|
|
Loading…
Reference in New Issue