Fixed a bug in select_last_cpu_mhz_for_vms when there is no data collected for a VM yet
This commit is contained in:
parent
ad1371bc2c
commit
5b001e16ae
@ -81,8 +81,13 @@ class Database(object):
|
||||
vms_cpu_mhz = dict(self.connection.execute(sel).fetchall())
|
||||
vms_uuids = dict(self.vms.select().execute().fetchall())
|
||||
|
||||
return dict((str(uuid), int(vms_cpu_mhz[id]))
|
||||
for id, uuid in vms_uuids.items())
|
||||
vms_last_mhz = {}
|
||||
for id, uuid in vms_uuids.items():
|
||||
if id in vms_cpu_mhz:
|
||||
vms_last_mhz[str(uuid)] = int(vms_cpu_mhz[id])
|
||||
else:
|
||||
vms_last_mhz[str(uuid)] = 0
|
||||
return vms_last_mhz
|
||||
|
||||
@contract
|
||||
def select_vm_id(self, uuid):
|
||||
|
@ -48,7 +48,7 @@ class Db(TestCase):
|
||||
assert db.select_cpu_mhz_for_vm(uuid, n) == cpu_mhz[-n:]
|
||||
|
||||
@qc(10)
|
||||
def select_last_cpu_mhz_for_vm(
|
||||
def select_last_cpu_mhz_for_vms(
|
||||
vms=dict_(
|
||||
keys=str_(of='abc123-', min_length=36, max_length=36),
|
||||
values=list_(of=int_(min=1, max=3000),
|
||||
|
Loading…
x
Reference in New Issue
Block a user