2011-06-16 19:28:54 -04:00
|
|
|
Shindo.tests('Fog::Compute[:ninefold] | server requests', ['ninefold']) do
|
2011-05-09 20:22:23 -04:00
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
|
|
|
|
2011-05-11 18:06:08 -04:00
|
|
|
tests("#deploy_virtual_machine()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINE) do
|
2011-05-09 20:22:23 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
networks = Fog::Compute[:ninefold].list_networks
|
2011-05-09 20:22:23 -04:00
|
|
|
|
|
|
|
unless networks[0]
|
|
|
|
raise "No networks, ensure a network has been created by deploying a VM from the web UI and verify list_networks test"
|
|
|
|
end
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
newvm = Fog::Compute[:ninefold].deploy_virtual_machine(:serviceofferingid => Ninefold::Compute::TestSupport::SERVICE_OFFERING,
|
2011-05-09 20:22:23 -04:00
|
|
|
:templateid => Ninefold::Compute::TestSupport::TEMPLATE_ID,
|
|
|
|
:zoneid => Ninefold::Compute::TestSupport::ZONE_ID,
|
|
|
|
:networkids => networks[0]['id'])
|
|
|
|
# wait for deployment, stash the job id.
|
|
|
|
@newvmid = newvm['id']
|
2011-06-22 18:08:38 -04:00
|
|
|
Ninefold::Compute::TestSupport.wait_for_job(newvm['jobid'])['jobresult']['virtualmachine']
|
2011-05-09 20:22:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("#list_virtual_machines()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINES) do
|
|
|
|
pending if Fog.mocking?
|
2011-06-22 18:08:38 -04:00
|
|
|
Fog::Compute[:ninefold].list_virtual_machines
|
2011-05-09 20:22:23 -04:00
|
|
|
end
|
|
|
|
|
2011-05-11 18:06:08 -04:00
|
|
|
tests("#reboot_virtual_machine()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINE) do
|
2011-05-09 20:22:23 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
job = Fog::Compute[:ninefold].reboot_virtual_machine(:id => @newvmid)
|
2011-06-22 18:08:38 -04:00
|
|
|
Ninefold::Compute::TestSupport.wait_for_job(job)['jobresult']['virtualmachine']
|
2011-05-09 20:22:23 -04:00
|
|
|
end
|
|
|
|
|
2011-05-11 18:06:08 -04:00
|
|
|
tests("#stop_virtual_machine()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINE) do
|
2011-05-09 20:22:23 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
job = Fog::Compute[:ninefold].stop_virtual_machine(:id => @newvmid)
|
2011-06-22 18:08:38 -04:00
|
|
|
Ninefold::Compute::TestSupport.wait_for_job(job)['jobresult']['virtualmachine']
|
2011-05-09 20:22:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("#change_service_for_virtual_machine()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINE) do
|
|
|
|
pending if Fog.mocking?
|
2011-06-22 18:08:38 -04:00
|
|
|
Fog::Compute[:ninefold].change_service_for_virtual_machine(:id => @newvmid,
|
2011-05-09 20:22:23 -04:00
|
|
|
:serviceofferingid => Ninefold::Compute::TestSupport::ALT_SERVICE_OFFERING)
|
|
|
|
end
|
|
|
|
|
2011-05-11 18:06:08 -04:00
|
|
|
tests("#start_virtual_machine()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINE) do
|
2011-05-09 20:22:23 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
job = Fog::Compute[:ninefold].start_virtual_machine(:id => @newvmid)
|
2011-06-22 18:08:38 -04:00
|
|
|
Ninefold::Compute::TestSupport.wait_for_job(job)['jobresult']['virtualmachine']
|
2011-05-09 20:22:23 -04:00
|
|
|
end
|
|
|
|
|
2011-05-11 18:06:08 -04:00
|
|
|
tests("#destroy_virtual_machine()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINE) do
|
2011-05-09 20:22:23 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
job = Fog::Compute[:ninefold].destroy_virtual_machine(:id => @newvmid)
|
2011-06-22 18:08:38 -04:00
|
|
|
Ninefold::Compute::TestSupport.wait_for_job(job)['jobresult']['virtualmachine']
|
2011-05-09 20:22:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
|
|
|
|
tests("#deploy_virtual_machine()").raises(Excon::Errors::HTTPStatusError) do
|
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:ninefold].deploy_virtual_machine
|
2011-05-09 20:22:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|