1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[ovirt] Added tests for update volume

This commit is contained in:
Bert Hajee 2014-10-29 13:24:41 +01:00 committed by Erik van Pienbroek
parent 436b84d8d1
commit d694d3fc41
3 changed files with 25 additions and 1 deletions

View file

@ -65,6 +65,10 @@ namespace :test do
task :openvz do
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/openvz")
end
task :ovirt do
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/ovirt")
end
end
desc 'Run mocked tests for a specific provider'

View file

@ -18,7 +18,7 @@ Shindo.tests('Fog::Compute[:ovirt]', ['ovirt']) do
%w{ add_interface create_vm datacenters destroy_interface destroy_vm get_cluster get_template
get_virtual_machine list_clusters list_networks list_template_interfaces list_templates
list_virtual_machines list_vm_interfaces storage_domains update_interface update_vm vm_action
api_version}.each do |collection|
api_version update_volume}.each do |collection|
test("it should respond to #{collection}") { compute.respond_to? collection }
end
end

View file

@ -0,0 +1,20 @@
Shindo.tests('Fog::Compute[:ovirt] | update_volume request', ['ovirt']) do
compute = Fog::Compute[:ovirt]
if compute.servers.all(:search => 'fog-*').empty?
compute.create_vm(:name => 'fog-'+Time.now.to_i.to_s, :cluster_name => 'Default')
end
vm_id = compute.servers.all(:search => 'fog-*').last
tests('The expected options') do
raises(ArgumentError, 'raises ArgumentError when vm id is missing') { compute.update_volume(nil, {:id => 1}) }
raises(ArgumentError, 'raises ArgumentError when disk_id option is missing') { compute.update_volume(1, {:any => 1}) }
end
tests('The response should') do
response = compute.update_volume(vm_id, :id => 1)
test('be a success') { response ? true: false }
end
end