mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Add Mocks for VM VirtualHardwareSection GET methods
This commit is contained in:
parent
84306b6fcc
commit
dfdd0e376a
8 changed files with 350 additions and 110 deletions
|
@ -22,7 +22,44 @@ module Fog
|
|||
:path => "vApp/#{id}/virtualHardwareSection/cpu"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def get_cpu_rasd_item(id)
|
||||
type = 'application/vnd.vmware.vcloud.rasdItem+xml'
|
||||
|
||||
unless vm = data[:vms][id]
|
||||
raise Fog::Compute::VcloudDirector::Forbidden.new(
|
||||
'This operation is denied.'
|
||||
)
|
||||
end
|
||||
|
||||
Excon::Response.new(
|
||||
:status => 200,
|
||||
:headers => {'Content-Type' => "#{type};version=#{api_version}"},
|
||||
:body => get_cpu_rasd_item_body(id, vm)
|
||||
)
|
||||
end
|
||||
|
||||
def get_cpu_rasd_item_body(id, vm)
|
||||
{
|
||||
:ns12_href => make_href("vApp/#{id}/virtualHardwareSection/cpu"),
|
||||
:ns12_type => "application/vnd.vmware.vcloud.rasdItem+xml",
|
||||
:"rasd:AllocationUnits"=>"hertz * 10^6",
|
||||
:"rasd:Description"=>"Number of Virtual CPUs",
|
||||
:"rasd:ElementName"=>"#{vm[:cpu_count]} virtual CPU(s)",
|
||||
:"rasd:InstanceID"=>"4",
|
||||
:"rasd:Reservation"=>"0",
|
||||
:"rasd:ResourceType"=>"3",
|
||||
:"rasd:VirtualQuantity"=>"#{vm[:cpu_count]}",
|
||||
:"rasd:Weight"=>"0",
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,6 +21,70 @@ module Fog
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def get_disks_rasd_items_list(id)
|
||||
type = 'application/vnd.vmware.vcloud.rasdItemsList+xml'
|
||||
|
||||
unless vm = data[:vms][id]
|
||||
raise Fog::Compute::VcloudDirector::Forbidden.new(
|
||||
'This operation is denied.'
|
||||
)
|
||||
end
|
||||
|
||||
body = {
|
||||
:type => type,
|
||||
:href => make_href("vApp/#{id}/virtualHardwareSection/disks"),
|
||||
:Link => {
|
||||
:rel=>"edit",
|
||||
:type=>"application/vnd.vmware.vcloud.rasdItemsList+xml",
|
||||
:href=>make_href("vApp/#{id}/virtualHardwareSection/disks"),
|
||||
},
|
||||
:Item => [
|
||||
get_disks_rasd_items_list_body(id, vm),
|
||||
get_media_rasd_item_ide_controller_body(id, vm),
|
||||
].flatten
|
||||
}
|
||||
|
||||
Excon::Response.new(
|
||||
:status => 200,
|
||||
:headers => {'Content-Type' => "#{type};version=#{api_version}"},
|
||||
:body => body,
|
||||
)
|
||||
end
|
||||
|
||||
def get_disks_rasd_items_list_body(id, vm)
|
||||
[
|
||||
{
|
||||
:"rasd:Address"=>"0",
|
||||
:"rasd:Description"=>"SCSI Controller",
|
||||
:"rasd:ElementName"=>"SCSI Controller 0",
|
||||
:"rasd:InstanceID"=>"2",
|
||||
:"rasd:ResourceSubType"=>"lsilogic",
|
||||
:"rasd:ResourceType"=>"6"
|
||||
},
|
||||
|
||||
# TODO: Add support for adding disks
|
||||
{
|
||||
:"rasd:AddressOnParent"=>"0",
|
||||
:"rasd:Description"=>"Hard disk",
|
||||
:"rasd:ElementName"=>"Hard disk 1",
|
||||
:"rasd:HostResource"=>{
|
||||
:ns12_capacity=>"51200",
|
||||
:ns12_busSubType=>"lsilogic",
|
||||
:ns12_busType=>"6"
|
||||
},
|
||||
:"rasd:InstanceID"=>"2000",
|
||||
:"rasd:Parent"=>"2",
|
||||
:"rasd:ResourceType"=>"17"
|
||||
},
|
||||
|
||||
]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,6 +20,50 @@ module Fog
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def get_guest_customization_system_section_vapp(id)
|
||||
|
||||
type = 'application/vnd.vmware.vcloud.guestCustomizationSection+xml'
|
||||
|
||||
unless vm = data[:vms][id]
|
||||
raise Fog::Compute::VcloudDirector::Forbidden.new(
|
||||
'This operation is denied.'
|
||||
)
|
||||
end
|
||||
|
||||
Excon::Response.new(
|
||||
:status => 200,
|
||||
:headers => {'Content-Type' => "#{type};version=#{api_version}"},
|
||||
:body => get_vm_guest_customization_section_body(id, vm)
|
||||
)
|
||||
end
|
||||
|
||||
def get_vm_guest_customization_section_body(id, vm)
|
||||
{
|
||||
:type => "application/vnd.vmware.vcloud.guestCustomizationSection+xml",
|
||||
:href => make_href("vApp/#{id}/guestCustomizationSection/"),
|
||||
:ovf_required => "false",
|
||||
:"ovf:Info" => "Specifies Guest OS Customization Settings",
|
||||
:Enabled => "true",
|
||||
:ChangeSid => "false",
|
||||
:VirtualMachineId => id.split('-').last, # strip the 'vm-' prefix
|
||||
:JoinDomainEnabled => "false",
|
||||
:UseOrgSettings => "false",
|
||||
:AdminPasswordEnabled => "false",
|
||||
:AdminPasswordAuto => "true",
|
||||
:ResetPasswordRequired => "false",
|
||||
:CustomizationScript => vm[:customization_script] || "",
|
||||
:ComputerName => vm[:computer_name] || vm[:name],
|
||||
:Link => {
|
||||
:rel=>"edit",
|
||||
:type=>"application/vnd.vmware.vcloud.guestCustomizationSection+xml",
|
||||
:href=>make_href("vApp/#{id}"),
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,6 +21,72 @@ module Fog
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def get_media_drives_rasd_items_list(id)
|
||||
type = 'application/vnd.vmware.vcloud.rasdItemsList+xml'
|
||||
|
||||
unless vm = data[:vms][id]
|
||||
raise Fog::Compute::VcloudDirector::Forbidden.new(
|
||||
'This operation is denied.'
|
||||
)
|
||||
end
|
||||
|
||||
body = {
|
||||
:type => type,
|
||||
:href => make_href("vApp/#{id}/virtualHardwareSection/media"),
|
||||
:Item => [
|
||||
get_media_rasd_item_ide_controller_body(id, vm),
|
||||
get_media_rasd_item_cdrom_body(id, vm),
|
||||
get_media_rasd_item_floppy_body(id, vm),
|
||||
]
|
||||
}
|
||||
|
||||
Excon::Response.new(
|
||||
:status => 200,
|
||||
:headers => {'Content-Type' => "#{type};version=#{api_version}"},
|
||||
:body => body,
|
||||
)
|
||||
end
|
||||
|
||||
def get_media_rasd_item_ide_controller_body(id, vm)
|
||||
{
|
||||
:"rasd:Address"=>"0",
|
||||
:"rasd:Description"=>"IDE Controller",
|
||||
:"rasd:ElementName"=>"IDE Controller 0",
|
||||
:"rasd:InstanceID"=>"3",
|
||||
:"rasd:ResourceType"=>"5"
|
||||
}
|
||||
end
|
||||
|
||||
def get_media_rasd_item_cdrom_body(id, vm)
|
||||
{
|
||||
:"rasd:AddressOnParent"=>"1",
|
||||
:"rasd:AutomaticAllocation"=>"true",
|
||||
:"rasd:Description"=>"CD/DVD Drive",
|
||||
:"rasd:ElementName"=>"CD/DVD Drive 1",
|
||||
:"rasd:HostResource"=>"",
|
||||
:"rasd:InstanceID"=>"3000",
|
||||
:"rasd:Parent"=>"3",
|
||||
:"rasd:ResourceType"=>"15"
|
||||
}
|
||||
end
|
||||
|
||||
def get_media_rasd_item_floppy_body(id, vm)
|
||||
{
|
||||
:"rasd:AddressOnParent"=>"0",
|
||||
:"rasd:AutomaticAllocation"=>"false",
|
||||
:"rasd:Description"=>"Floppy Drive",
|
||||
:"rasd:ElementName"=>"Floppy Drive 1",
|
||||
:"rasd:HostResource"=>"",
|
||||
:"rasd:InstanceID"=>"8000",
|
||||
:"rasd:ResourceType"=>"14"
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,6 +23,42 @@ module Fog
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def get_memory_rasd_item(id)
|
||||
type = 'application/vnd.vmware.vcloud.rasdItem+xml'
|
||||
|
||||
unless vm = data[:vms][id]
|
||||
raise Fog::Compute::VcloudDirector::Forbidden.new(
|
||||
'This operation is denied.'
|
||||
)
|
||||
end
|
||||
|
||||
Excon::Response.new(
|
||||
:status => 200,
|
||||
:headers => {'Content-Type' => "#{type};version=#{api_version}"},
|
||||
:body => get_memory_rasd_item_body(id, vm)
|
||||
)
|
||||
end
|
||||
|
||||
def get_memory_rasd_item_body(id, vm)
|
||||
{
|
||||
:ns12_href => make_href("vApp/#{id}/virtualHardwareSection/memory"),
|
||||
:ns12_type=>"application/vnd.vmware.vcloud.rasdItem+xml",
|
||||
:"rasd:AllocationUnits"=>"byte * 2^20",
|
||||
:"rasd:Description"=>"Memory Size",
|
||||
:"rasd:ElementName"=>"#{vm[:memory_in_mb]} MB of memory",
|
||||
:"rasd:InstanceID"=>"5",
|
||||
:"rasd:Reservation"=>"0",
|
||||
:"rasd:ResourceType"=>"4",
|
||||
:"rasd:VirtualQuantity"=>"#{vm[:memory_in_mb]}",
|
||||
:"rasd:Weight"=>"0",
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,6 +20,51 @@ module Fog
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def get_network_cards_items_list(id)
|
||||
type = 'application/vnd.vmware.vcloud.rasdItemsList+xml'
|
||||
|
||||
unless vm = data[:vms][id]
|
||||
raise Fog::Compute::VcloudDirector::Forbidden.new(
|
||||
'This operation is denied.'
|
||||
)
|
||||
end
|
||||
|
||||
body = {
|
||||
:type => type,
|
||||
:href => make_href("vApp/#{id}/virtualHardwareSection/networkCards"),
|
||||
:Link => {
|
||||
:rel=>"edit",
|
||||
:type=>"application/vnd.vmware.vcloud.rasdItemsList+xml",
|
||||
:href=>make_href("vApp/#{id}/virtualHardwareSection/networkCards"),
|
||||
},
|
||||
:Item => get_network_cards_rasd_items_list_body(id, vm)
|
||||
}
|
||||
|
||||
Excon::Response.new(
|
||||
:status => 200,
|
||||
:headers => {'Content-Type' => "#{type};version=#{api_version}"},
|
||||
:body => body,
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
def get_network_cards_rasd_items_list_body(id, vm)
|
||||
[{
|
||||
:"rasd:Address" => vm[:nics][0][:mac_address],
|
||||
:"rasd:AddressOnParent" => "0",
|
||||
:"rasd:AutomaticAllocation" => "true",
|
||||
:"rasd:Connection" => vm[:nics][0][:network_name],
|
||||
:"rasd:Description" => "E1000 ethernet adapter",
|
||||
:"rasd:ElementName" => "Network adapter 0",
|
||||
:"rasd:InstanceID" => "1",
|
||||
:"rasd:ResourceSubType" => "E1000",
|
||||
:"rasd:ResourceType" => "10"
|
||||
}]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -175,6 +175,7 @@ module Fog
|
|||
get_mock_vm_body(vm_id)
|
||||
end
|
||||
end
|
||||
|
||||
def get_vm_ovfenv_environment_section_body(id, vm)
|
||||
# TODO: I'm pretty sure this is just repeating info in other
|
||||
# sections, and the OVF part of VMs is extremely verbose. It's
|
||||
|
@ -230,25 +231,6 @@ module Fog
|
|||
}
|
||||
end
|
||||
|
||||
def get_vm_guest_customization_section_body(id, vm)
|
||||
{
|
||||
:type => "application/vnd.vmware.vcloud.guestCustomizationSection+xml",
|
||||
:href => make_href("vApp/#{id}/guestCustomizationSection/"),
|
||||
:ovf_required => "false",
|
||||
:"ovf:Info" => "Specifies Guest OS Customization Settings",
|
||||
:Enabled => "true",
|
||||
:ChangeSid => "false",
|
||||
:VirtualMachineId => id.split('-').last, # strip the 'vm-' prefix
|
||||
:JoinDomainEnabled => "false",
|
||||
:UseOrgSettings => "false",
|
||||
:AdminPasswordEnabled => "false",
|
||||
:AdminPasswordAuto => "true",
|
||||
:ResetPasswordRequired => "false",
|
||||
:CustomizationScript => vm[:customization_script] || "",
|
||||
:ComputerName => vm[:computer_name] || vm[:name],
|
||||
}
|
||||
end
|
||||
|
||||
def get_vm_operating_system_section_body(id, vm)
|
||||
{
|
||||
:xmlns_ns12=>"http://www.vmware.com/vcloud/v1.5",
|
||||
|
@ -283,94 +265,22 @@ module Fog
|
|||
:"vssd:VirtualSystemIdentifier" => vm[:name],
|
||||
:"vssd:VirtualSystemType"=>"vmx-08"
|
||||
},
|
||||
|
||||
:"ovf:Item"=>[
|
||||
|
||||
{:"rasd:Address" => vm[:nics][0][:mac_address],
|
||||
:"rasd:AddressOnParent" => "0",
|
||||
:"rasd:AutomaticAllocation" => "true",
|
||||
:"rasd:Connection" => vm[:nics][0][:network_name],
|
||||
:"rasd:Description" => "E1000 ethernet adapter",
|
||||
:"rasd:ElementName" => "Network adapter 0",
|
||||
:"rasd:InstanceID" => "1",
|
||||
:"rasd:ResourceSubType" => "E1000",
|
||||
:"rasd:ResourceType" => "10"
|
||||
},
|
||||
|
||||
{:"rasd:Address"=>"0",
|
||||
:"rasd:Description"=>"SCSI Controller",
|
||||
:"rasd:ElementName"=>"SCSI Controller 0",
|
||||
:"rasd:InstanceID"=>"2",
|
||||
:"rasd:ResourceSubType"=>"lsilogic",
|
||||
:"rasd:ResourceType"=>"6"
|
||||
},
|
||||
|
||||
{:"rasd:AddressOnParent"=>"0",
|
||||
:"rasd:Description"=>"Hard disk",
|
||||
:"rasd:ElementName"=>"Hard disk 1",
|
||||
:"rasd:HostResource"=>{
|
||||
:ns12_capacity=>"51200",
|
||||
:ns12_busSubType=>"lsilogic",
|
||||
:ns12_busType=>"6"
|
||||
},
|
||||
:"rasd:InstanceID"=>"2000",
|
||||
:"rasd:Parent"=>"2",
|
||||
:"rasd:ResourceType"=>"17"
|
||||
},
|
||||
|
||||
{:"rasd:Address"=>"0",
|
||||
:"rasd:Description"=>"IDE Controller",
|
||||
:"rasd:ElementName"=>"IDE Controller 0",
|
||||
:"rasd:InstanceID"=>"3",
|
||||
:"rasd:ResourceType"=>"5"
|
||||
},
|
||||
|
||||
{:"rasd:AddressOnParent"=>"1",
|
||||
:"rasd:AutomaticAllocation"=>"true",
|
||||
:"rasd:Description"=>"CD/DVD Drive",
|
||||
:"rasd:ElementName"=>"CD/DVD Drive 1",
|
||||
:"rasd:HostResource"=>"",
|
||||
:"rasd:InstanceID"=>"3000",
|
||||
:"rasd:Parent"=>"3",
|
||||
:"rasd:ResourceType"=>"15"
|
||||
},
|
||||
|
||||
{:"rasd:AddressOnParent"=>"0",
|
||||
:"rasd:AutomaticAllocation"=>"false",
|
||||
:"rasd:Description"=>"Floppy Drive",
|
||||
:"rasd:ElementName"=>"Floppy Drive 1",
|
||||
:"rasd:HostResource"=>"",
|
||||
:"rasd:InstanceID"=>"8000",
|
||||
:"rasd:ResourceType"=>"14"
|
||||
},
|
||||
|
||||
{:ns12_href => make_href("vApp/#{id}/virtualHardwareSection/cpu"),
|
||||
:ns12_type => "application/vnd.vmware.vcloud.rasdItem+xml",
|
||||
:"rasd:AllocationUnits"=>"hertz * 10^6",
|
||||
:"rasd:Description"=>"Number of Virtual CPUs",
|
||||
:"rasd:ElementName"=>"1 virtual CPU(s)",
|
||||
:"rasd:InstanceID"=>"4",
|
||||
:"rasd:Reservation"=>"0",
|
||||
:"rasd:ResourceType"=>"3",
|
||||
:"rasd:VirtualQuantity"=>vm[:cpu_count],
|
||||
:"rasd:Weight"=>"0",
|
||||
},
|
||||
|
||||
{:ns12_href => make_href("vApp/#{id}/virtualHardwareSection/memory"),
|
||||
:ns12_type=>"application/vnd.vmware.vcloud.rasdItem+xml",
|
||||
:"rasd:AllocationUnits"=>"byte * 2^20",
|
||||
:"rasd:Description"=>"Memory Size",
|
||||
:"rasd:ElementName"=>"#{vm[:memory_in_mb]} MB of memory",
|
||||
:"rasd:InstanceID"=>"5",
|
||||
:"rasd:Reservation"=>"0",
|
||||
:"rasd:ResourceType"=>"4",
|
||||
:"rasd:VirtualQuantity"=>vm[:memory_in_mb],
|
||||
:"rasd:Weight"=>"0",
|
||||
},
|
||||
],
|
||||
:"ovf:Item" => get_vm_ovf_item_list(id, vm),
|
||||
}
|
||||
end
|
||||
|
||||
def get_vm_ovf_item_list(id, vm)
|
||||
[
|
||||
get_network_cards_rasd_items_list_body(id, vm),
|
||||
get_disks_rasd_items_list_body(id, vm),
|
||||
get_media_rasd_item_cdrom_body(id, vm),
|
||||
get_media_rasd_item_floppy_body(id, vm),
|
||||
get_cpu_rasd_item_body(id, vm),
|
||||
get_memory_rasd_item_body(id, vm),
|
||||
].compact.flatten
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -16,6 +16,7 @@ Shindo.tests('Compute::VcloudDirector | vm requests', ['vclouddirector']) do
|
|||
vapp = @service.get_vapp(vapp_id).body
|
||||
|
||||
tests('Each VM') do
|
||||
|
||||
vapp[:Children][:Vm].each do |vm|
|
||||
vm_id = vm[:href].split('/').last
|
||||
|
||||
|
@ -31,60 +32,96 @@ Shindo.tests('Compute::VcloudDirector | vm requests', ['vclouddirector']) do
|
|||
@service.get_vapp(vm_id).body[:href]
|
||||
end
|
||||
|
||||
tests("#get_vapp(#{vm_id}).body[:GuestCustomizationSection]").returns(Hash) do
|
||||
@service.get_vapp(vm_id).body[:GuestCustomizationSection].class
|
||||
end
|
||||
|
||||
tests("#get_vapp(#{vm_id}).body[:GuestCustomizationSection]").data_matches_schema(VcloudDirector::Compute::Schema::GUEST_CUSTOMIZATION_SECTION_TYPE) do
|
||||
@service.get_vapp(vm_id).body[:GuestCustomizationSection]
|
||||
end
|
||||
|
||||
tests("#get_guest_customization_system_section_vapp(#{vm_id})").returns(Hash) do
|
||||
@service.get_guest_customization_system_section_vapp(vm_id).body.class
|
||||
end
|
||||
|
||||
tests("#get_guest_customization_system_section_vapp(#{vm_id})").data_matches_schema(VcloudDirector::Compute::Schema::GUEST_CUSTOMIZATION_SECTION_TYPE) do
|
||||
pending if Fog.mocking?
|
||||
@service.get_guest_customization_system_section_vapp(vm_id).body
|
||||
end
|
||||
|
||||
tests("#get_network_connection_system_section_vapp(#{vm_id})").returns(Hash) do
|
||||
pending if Fog.mocking?
|
||||
@service.get_network_connection_system_section_vapp(vm_id).body.class
|
||||
end
|
||||
|
||||
tests("#get_operating_system_section(#{vm_id})").returns(Hash) do
|
||||
pending if Fog.mocking?
|
||||
@service.get_operating_system_section(vm_id).body.class
|
||||
end
|
||||
|
||||
tests("#get_product_sections_vapp(#{vm_id})").returns(Hash) do
|
||||
pending if Fog.mocking?
|
||||
@service.get_product_sections_vapp(vm_id).body.class
|
||||
end
|
||||
|
||||
tests("#get_runtime_info_section_type(#{vm_id})").data_matches_schema(VcloudDirector::Compute::Schema::RUNTIME_INFO_SECTION_TYPE) do
|
||||
pending if Fog.mocking?
|
||||
pending # fails if WMware Tools not installed
|
||||
@service.get_runtime_info_section_type(vm_id).body
|
||||
end
|
||||
|
||||
tests("#get_snapshot_section(#{vm_id})").returns(Hash) do
|
||||
pending if Fog.mocking?
|
||||
@service.get_snapshot_section(vm_id).body.class
|
||||
end
|
||||
|
||||
tests("#get_vm_capabilities(#{vm_id})").data_matches_schema(VcloudDirector::Compute::Schema::VM_CAPABILITIES_TYPE) do
|
||||
pending if Fog.mocking?
|
||||
@service.get_vm_capabilities(vm_id).body
|
||||
end
|
||||
|
||||
tests("#get_vapp(#{vm_id}).body[:'ovf:VirtualHardwareSection']").returns(Hash) do
|
||||
@section = @service.get_vapp(vm_id).body[:'ovf:VirtualHardwareSection'].class
|
||||
end
|
||||
|
||||
tests("#get_virtual_hardware_section(#{vm_id})").returns(Hash) do
|
||||
pending if Fog.mocking?
|
||||
@section = @service.get_virtual_hardware_section(vm_id).body.class
|
||||
end
|
||||
|
||||
tests("#get_cpu_rasd_item(#{vm_id})").returns(Hash) do
|
||||
pending if Fog.mocking?
|
||||
@service.get_cpu_rasd_item(vm_id).body.class
|
||||
end
|
||||
|
||||
tests("#get_disks_rasd_items_list(#{vm_id})").returns(Hash) do
|
||||
pending if Fog.mocking?
|
||||
@service.get_disks_rasd_items_list(vm_id).body.class
|
||||
end
|
||||
|
||||
tests("#get_disks_rasd_items_list(#{vm_id}).body[:Item]").returns(Array) do
|
||||
@service.get_disks_rasd_items_list(vm_id).body[:Item].class
|
||||
end
|
||||
|
||||
tests("#get_media_drives_rasd_items_list(#{vm_id})").returns(Hash) do
|
||||
pending if Fog.mocking?
|
||||
@service.get_media_drives_rasd_items_list(vm_id).body.class
|
||||
end
|
||||
|
||||
tests("#get_media_drives_rasd_items_list(#{vm_id}).body[:Item]").returns(Array) do
|
||||
@service.get_media_drives_rasd_items_list(vm_id).body[:Item].class
|
||||
end
|
||||
|
||||
tests("#get_memory_rasd_item(#{vm_id})").returns(Hash) do
|
||||
pending if Fog.mocking?
|
||||
@service.get_memory_rasd_item(vm_id).body.class
|
||||
end
|
||||
|
||||
tests("#get_vapp(#{vm_id}) ovf:VirtualHardwareSection has a Network adapter listed").returns(Hash) do
|
||||
@service.get_vapp(vm_id).body[:'ovf:VirtualHardwareSection'][:'ovf:Item'].detect do |rasd_item|
|
||||
rasd_item[:'rasd:ElementName'] =~ /^Network adapter/
|
||||
end.class
|
||||
end
|
||||
|
||||
tests("#get_network_cards_items_list(#{vm_id})").returns(Hash) do
|
||||
pending if Fog.mocking?
|
||||
@service.get_network_cards_items_list(vm_id).body.class
|
||||
end
|
||||
|
||||
tests("#get_serial_ports_items_list(#{vm_id})").returns(Hash) do
|
||||
pending if Fog.mocking?
|
||||
@service.get_serial_ports_items_list(vm_id).body.class
|
||||
|
@ -99,6 +136,7 @@ Shindo.tests('Compute::VcloudDirector | vm requests', ['vclouddirector']) do
|
|||
pending # result depends on power state
|
||||
@service.post_acquire_ticket(vm_id).body
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue