2011-11-09 11:26:32 -05:00
|
|
|
Shindo.tests("Fog::Compute[:vsphere] | vm_clone request", 'vsphere') do
|
2012-01-19 14:42:39 -05:00
|
|
|
# require 'guid'
|
2011-09-10 16:27:52 -04:00
|
|
|
compute = Fog::Compute[:vsphere]
|
2012-01-17 22:58:08 -05:00
|
|
|
response = nil
|
|
|
|
response_linked = nil
|
2011-09-10 16:27:52 -04:00
|
|
|
|
2012-01-17 22:58:08 -05:00
|
|
|
template = "/Datacenters/Solutions/vm/Jeff/Templates/centos56gm2"
|
2012-01-17 22:42:53 -05:00
|
|
|
tests("Standard Clone | The return value should") do
|
|
|
|
response = compute.vm_clone('path' => template, 'name' => 'cloning_vm', 'wait' => 1)
|
2011-09-10 16:27:52 -04:00
|
|
|
test("be a kind of Hash") { response.kind_of? Hash }
|
|
|
|
%w{ vm_ref task_ref }.each do |key|
|
|
|
|
test("have a #{key} key") { response.has_key? key }
|
|
|
|
end
|
|
|
|
end
|
2012-01-19 14:38:25 -05:00
|
|
|
|
|
|
|
template = "/Datacenters/Solutions/vm/Jeff/Templates/centos56gm2"
|
2012-01-17 22:42:53 -05:00
|
|
|
tests("Linked Clone | The return value should") do
|
2012-01-19 14:38:25 -05:00
|
|
|
response = compute.vm_clone('path' => template, 'name' => 'cloning_vm_linked', 'wait' => 1, 'linked_clone' => true)
|
|
|
|
test("be a kind of Hash") { response.kind_of? Hash }
|
2012-01-17 22:42:53 -05:00
|
|
|
%w{ vm_ref task_ref }.each do |key|
|
2012-01-19 14:38:25 -05:00
|
|
|
test("have a #{key} key") { response.has_key? key }
|
2012-01-17 22:42:53 -05:00
|
|
|
end
|
|
|
|
end
|
2012-01-19 14:38:25 -05:00
|
|
|
|
2011-09-10 16:27:52 -04:00
|
|
|
tests("When invalid input is presented") do
|
|
|
|
raises(ArgumentError, 'it should raise ArgumentError') { compute.vm_clone(:foo => 1) }
|
2011-09-14 13:15:19 -04:00
|
|
|
raises(Fog::Compute::Vsphere::NotFound, 'it should raise Fog::Compute::Vsphere::NotFound when the UUID is not a string') do
|
2011-09-22 20:54:11 -04:00
|
|
|
pending # require 'guid'
|
2011-09-14 13:15:19 -04:00
|
|
|
compute.vm_clone('instance_uuid' => Guid.from_s(template), 'name' => 'jefftestfoo')
|
|
|
|
end
|
2011-09-10 16:27:52 -04:00
|
|
|
end
|
|
|
|
end
|