1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

feature #696: Fix monitoring tests

This commit is contained in:
Daniel Molina 2011-07-08 18:30:12 +02:00
parent 757c773503
commit f5dde30ce8
3 changed files with 11 additions and 12 deletions

View File

@ -36,9 +36,9 @@ class MockClient
def add_vm(id, values)
if values[:state] == 6
@done_vms[id] = values
elsif
@vms[id] = values
@done_vms[id] = values.clone
else
@vms[id] = values.clone
end
end

View File

@ -88,16 +88,15 @@ describe "1 Vm 1 10 steps" do
]
}
@mock_client.add_vm(1, values)
@mock_client.add_vm(2, values)
values[:state] = 7
@mock_client.add_vm(i+100, values)
values[:state] = 3
@mock_client.add_vm(i+10, values)
@monitoring.insert(create_vmpool_hash)
#@db[:vms].count.should eql(1)
#@db[:vm_samples].count.should eql(1+i > 5 ? 5 : 1+i)
#pp @watch_client.vm_monitoring(1, ['cpu', 'net_tx'])
# "total"
pp @watch_client.vm_total('total')
@db[:vm_samples].count
total = @watch_client.vm_total([:total, :error, :active])
}
end
end

View File

@ -324,7 +324,7 @@ module WatchHelper
VmSample.multi_insert(@@samples_cache)
Vm.each { |vm|
if vm.samples.count > CONF[:WINDOW_SIZE] -1
if vm.samples.count > CONF[:WINDOW_SIZE]
vm.samples.first.delete
end
}
@ -371,7 +371,7 @@ module WatchHelper
HostSample.multi_insert(@@samples_cache)
Host.all.each { |host|
if host.samples.count > CONF[:WINDOW_SIZE] -1
if host.samples.count > CONF[:WINDOW_SIZE]
host.samples.first.delete
end
}