mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[opennebula] flavor: fixed get_vcpu and get_memory; added tests
This commit is contained in:
parent
75f33a1809
commit
8618c13d14
3 changed files with 9 additions and 2 deletions
|
@ -51,12 +51,12 @@ module Fog
|
|||
end
|
||||
|
||||
def get_vcpu
|
||||
return "VCPU=1\n" unless vcpu
|
||||
self.vcpu = 1 unless vcpu
|
||||
"VCPU=#{vcpu}\n"
|
||||
end
|
||||
|
||||
def get_memory
|
||||
return "MEMORY=128\n" unless memory
|
||||
self.memory = 128 unless memory
|
||||
"MEMORY=#{memory}\n"
|
||||
end
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@ module Fog
|
|||
def template_pool(filter = { })
|
||||
nic1 = Mock_nic.new
|
||||
nic1.vnet = networks.first
|
||||
|
||||
[
|
||||
{
|
||||
:content => %Q{
|
||||
|
|
|
@ -25,6 +25,12 @@ Shindo.tests('Fog::Compute[:opennebula] | flavor model', ['opennebula']) do
|
|||
end
|
||||
test('be a kind of Fog::Compute::OpenNebula::Flavor') { flavor.kind_of? Fog::Compute::OpenNebula::Flavor }
|
||||
test('have a nic in network fogtest') { flavor.nic[0].vnet.name == "fogtest" }
|
||||
|
||||
flavor.vcpu = 666
|
||||
flavor.memory = 666
|
||||
test('have a 666 MB memory') { flavor.get_memory == "MEMORY=666\n" }
|
||||
test('have a 666 CPUs') { flavor.get_vcpu == "VCPU=666\n" }
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue