Fixed select_cpu_mhz_for_vm to return the most recent values
This commit is contained in:
parent
b215fc67d3
commit
33a2588f59
@ -59,10 +59,10 @@ class Database(object):
|
||||
where(and_(
|
||||
self.vms.c.id == self.vm_resource_usage.c.vm_id,
|
||||
self.vms.c.uuid == uuid)). \
|
||||
order_by(self.vm_resource_usage.c.id.asc()). \
|
||||
order_by(self.vm_resource_usage.c.id.desc()). \
|
||||
limit(n)
|
||||
res = self.connection.execute(sel).fetchall()
|
||||
return [int(x[0]) for x in res]
|
||||
return list(reversed([int(x[0]) for x in res]))
|
||||
|
||||
@contract
|
||||
def select_last_cpu_mhz_for_vms(self):
|
||||
|
@ -224,7 +224,7 @@ class Collector(TestCase):
|
||||
db.vm_resource_usage.insert().execute(
|
||||
vm_id=vm_id,
|
||||
cpu_mhz=mhz)
|
||||
x[uuid] = data[:data_length]
|
||||
x[uuid] = data[-data_length:]
|
||||
assert collector.fetch_remote_data(db, data_length, x.keys()) == x
|
||||
|
||||
@qc
|
||||
|
@ -42,7 +42,7 @@ class Db(TestCase):
|
||||
db.vm_resource_usage.insert().execute(
|
||||
vm_id=vm_id,
|
||||
cpu_mhz=mhz)
|
||||
assert db.select_cpu_mhz_for_vm(uuid, n) == cpu_mhz[:n]
|
||||
assert db.select_cpu_mhz_for_vm(uuid, n) == cpu_mhz[-n:]
|
||||
|
||||
@qc(10)
|
||||
def select_last_cpu_mhz_for_vm(
|
||||
|
Loading…
x
Reference in New Issue
Block a user