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:
parent
436b84d8d1
commit
d694d3fc41
3 changed files with 25 additions and 1 deletions
4
Rakefile
4
Rakefile
|
@ -65,6 +65,10 @@ namespace :test do
|
||||||
task :openvz do
|
task :openvz do
|
||||||
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/openvz")
|
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/openvz")
|
||||||
end
|
end
|
||||||
|
task :ovirt do
|
||||||
|
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/ovirt")
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Run mocked tests for a specific provider'
|
desc 'Run mocked tests for a specific provider'
|
||||||
|
|
|
@ -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
|
%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
|
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
|
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 }
|
test("it should respond to #{collection}") { compute.respond_to? collection }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
20
tests/ovirt/requests/compute/update_volume_tests.rb
Normal file
20
tests/ovirt/requests/compute/update_volume_tests.rb
Normal 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
|
Loading…
Add table
Reference in a new issue