fog-ovirt 0.1.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +20 -0
  3. data/.rubocop_todo.yml +43 -0
  4. data/.travis.yml +3 -1
  5. data/Gemfile +1 -1
  6. data/Rakefile +15 -5
  7. data/fog-ovirt.gemspec +15 -14
  8. data/lib/fog/bin/ovirt.rb +1 -1
  9. data/lib/fog/ovirt.rb +1 -1
  10. data/lib/fog/ovirt/compute.rb +56 -112
  11. data/lib/fog/ovirt/compute/v3.rb +137 -0
  12. data/lib/fog/ovirt/core.rb +13 -4
  13. data/lib/fog/ovirt/models/compute/affinity_group.rb +2 -2
  14. data/lib/fog/ovirt/models/compute/affinity_groups.rb +2 -2
  15. data/lib/fog/ovirt/models/compute/clusters.rb +2 -2
  16. data/lib/fog/ovirt/models/compute/instance_types.rb +2 -2
  17. data/lib/fog/ovirt/models/compute/interfaces.rb +7 -5
  18. data/lib/fog/ovirt/models/compute/operating_systems.rb +3 -3
  19. data/lib/fog/ovirt/models/compute/quotas.rb +3 -3
  20. data/lib/fog/ovirt/models/compute/server.rb +37 -31
  21. data/lib/fog/ovirt/models/compute/servers.rb +2 -2
  22. data/lib/fog/ovirt/models/compute/template.rb +9 -9
  23. data/lib/fog/ovirt/models/compute/templates.rb +2 -2
  24. data/lib/fog/ovirt/models/compute/volume.rb +3 -3
  25. data/lib/fog/ovirt/models/compute/volumes.rb +6 -4
  26. data/lib/fog/ovirt/requests/compute/v3/activate_volume.rb +23 -0
  27. data/lib/fog/ovirt/requests/compute/v3/add_interface.rb +22 -0
  28. data/lib/fog/ovirt/requests/compute/v3/add_to_affinity_group.rb +23 -0
  29. data/lib/fog/ovirt/requests/compute/v3/add_volume.rb +23 -0
  30. data/lib/fog/ovirt/requests/compute/v3/attach_volume.rb +24 -0
  31. data/lib/fog/ovirt/requests/compute/v3/create_affinity_group.rb +20 -0
  32. data/lib/fog/ovirt/requests/compute/v3/create_vm.rb +20 -0
  33. data/lib/fog/ovirt/requests/compute/v3/datacenters.rb +22 -0
  34. data/lib/fog/ovirt/requests/compute/v3/deactivate_volume.rb +24 -0
  35. data/lib/fog/ovirt/requests/compute/v3/destroy_affinity_group.rb +21 -0
  36. data/lib/fog/ovirt/requests/compute/v3/destroy_interface.rb +24 -0
  37. data/lib/fog/ovirt/requests/compute/v3/destroy_vm.rb +21 -0
  38. data/lib/fog/ovirt/requests/compute/v3/destroy_volume.rb +24 -0
  39. data/lib/fog/ovirt/requests/compute/v3/detach_volume.rb +24 -0
  40. data/lib/fog/ovirt/requests/compute/v3/get_affinity_group.rb +20 -0
  41. data/lib/fog/ovirt/requests/compute/v3/get_api_version.rb +18 -0
  42. data/lib/fog/ovirt/requests/compute/v3/get_cluster.rb +19 -0
  43. data/lib/fog/ovirt/requests/compute/v3/get_instance_type.rb +19 -0
  44. data/lib/fog/ovirt/requests/compute/v3/get_quota.rb +19 -0
  45. data/lib/fog/ovirt/requests/compute/v3/get_template.rb +19 -0
  46. data/lib/fog/ovirt/requests/compute/v3/get_virtual_machine.rb +19 -0
  47. data/lib/fog/ovirt/requests/compute/v3/list_affinity_group_vms.rb +24 -0
  48. data/lib/fog/ovirt/requests/compute/v3/list_affinity_groups.rb +22 -0
  49. data/lib/fog/ovirt/requests/compute/v3/list_clusters.rb +21 -0
  50. data/lib/fog/ovirt/requests/compute/v3/list_instance_types.rb +21 -0
  51. data/lib/fog/ovirt/requests/compute/v3/list_networks.rb +18 -0
  52. data/lib/fog/ovirt/requests/compute/v3/list_operating_systems.rb +21 -0
  53. data/lib/fog/ovirt/requests/compute/v3/list_quotas.rb +21 -0
  54. data/lib/fog/ovirt/requests/compute/v3/list_template_interfaces.rb +21 -0
  55. data/lib/fog/ovirt/requests/compute/v3/list_template_volumes.rb +21 -0
  56. data/lib/fog/ovirt/requests/compute/v3/list_templates.rb +21 -0
  57. data/lib/fog/ovirt/requests/compute/v3/list_virtual_machines.rb +21 -0
  58. data/lib/fog/ovirt/requests/compute/v3/list_vm_interfaces.rb +21 -0
  59. data/lib/fog/ovirt/requests/compute/v3/list_vm_volumes.rb +21 -0
  60. data/lib/fog/ovirt/requests/compute/v3/list_volumes.rb +21 -0
  61. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/affinitygroup.xml +0 -0
  62. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/affinitygroup_vms.xml +0 -0
  63. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/affinitygroups.xml +0 -0
  64. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/cluster.xml +0 -0
  65. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/clusters.xml +0 -0
  66. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/data_centers.xml +0 -0
  67. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/disks.xml +0 -0
  68. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/instance_type.xml +0 -0
  69. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/instance_types.xml +0 -0
  70. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/nics.xml +0 -0
  71. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/operating_systems.xml +0 -0
  72. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/quotas.xml +0 -0
  73. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/storage_domains.xml +0 -0
  74. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/template.xml +0 -0
  75. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/templates.xml +0 -0
  76. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/vm.xml +0 -0
  77. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/vms.xml +0 -0
  78. data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/volumes.xml +0 -0
  79. data/lib/fog/ovirt/requests/compute/v3/remove_from_affinity_group.rb +23 -0
  80. data/lib/fog/ovirt/requests/compute/v3/storage_domains.rb +22 -0
  81. data/lib/fog/ovirt/requests/compute/v3/update_interface.rb +36 -0
  82. data/lib/fog/ovirt/requests/compute/v3/update_vm.rb +20 -0
  83. data/lib/fog/ovirt/requests/compute/v3/update_volume.rb +37 -0
  84. data/lib/fog/ovirt/requests/compute/v3/vm_action.rb +24 -0
  85. data/lib/fog/ovirt/requests/compute/v3/vm_start_with_cloudinit.rb +21 -0
  86. data/lib/fog/ovirt/requests/compute/v3/vm_ticket.rb +19 -0
  87. data/lib/fog/ovirt/version.rb +1 -1
  88. data/tests/helper.rb +1 -1
  89. data/tests/helpers/mock_helper.rb +4 -6
  90. data/tests/helpers/succeeds_helper.rb +1 -1
  91. data/tests/ovirt/compute_tests.rb +5 -6
  92. data/tests/ovirt/models/compute/cluster_tests.rb +10 -13
  93. data/tests/ovirt/models/compute/clusters_tests.rb +3 -5
  94. data/tests/ovirt/models/compute/interface_tests.rb +9 -11
  95. data/tests/ovirt/models/compute/interfaces_tests.rb +3 -5
  96. data/tests/ovirt/models/compute/operating_system_tests.rb +7 -13
  97. data/tests/ovirt/models/compute/operating_systems_tests.rb +4 -6
  98. data/tests/ovirt/models/compute/server_tests.rb +29 -32
  99. data/tests/ovirt/models/compute/servers_tests.rb +7 -9
  100. data/tests/ovirt/models/compute/template_tests.rb +10 -12
  101. data/tests/ovirt/models/compute/templates_tests.rb +3 -5
  102. data/tests/ovirt/requests/compute/client_tests.rb +31 -0
  103. data/tests/ovirt/requests/compute/create_vm_tests.rb +7 -16
  104. data/tests/ovirt/requests/compute/destroy_vm_tests.rb +8 -10
  105. data/tests/ovirt/requests/compute/list_datacenters_tests.rb +3 -5
  106. data/tests/ovirt/requests/compute/list_quotas_tests.rb +2 -4
  107. data/tests/ovirt/requests/compute/list_storage_domains_tests.rb +3 -5
  108. data/tests/ovirt/requests/compute/update_vm_tests.rb +9 -11
  109. data/tests/ovirt/requests/compute/update_volume_tests.rb +9 -12
  110. metadata +70 -65
  111. data/lib/fog/ovirt/requests/compute/activate_volume.rb +0 -22
  112. data/lib/fog/ovirt/requests/compute/add_interface.rb +0 -20
  113. data/lib/fog/ovirt/requests/compute/add_to_affinity_group.rb +0 -21
  114. data/lib/fog/ovirt/requests/compute/add_volume.rb +0 -21
  115. data/lib/fog/ovirt/requests/compute/attach_volume.rb +0 -22
  116. data/lib/fog/ovirt/requests/compute/create_affinity_group.rb +0 -18
  117. data/lib/fog/ovirt/requests/compute/create_vm.rb +0 -18
  118. data/lib/fog/ovirt/requests/compute/datacenters.rb +0 -20
  119. data/lib/fog/ovirt/requests/compute/deactivate_volume.rb +0 -22
  120. data/lib/fog/ovirt/requests/compute/destroy_affinity_group.rb +0 -19
  121. data/lib/fog/ovirt/requests/compute/destroy_interface.rb +0 -22
  122. data/lib/fog/ovirt/requests/compute/destroy_vm.rb +0 -19
  123. data/lib/fog/ovirt/requests/compute/destroy_volume.rb +0 -22
  124. data/lib/fog/ovirt/requests/compute/detach_volume.rb +0 -22
  125. data/lib/fog/ovirt/requests/compute/get_affinity_group.rb +0 -18
  126. data/lib/fog/ovirt/requests/compute/get_api_version.rb +0 -16
  127. data/lib/fog/ovirt/requests/compute/get_cluster.rb +0 -17
  128. data/lib/fog/ovirt/requests/compute/get_instance_type.rb +0 -17
  129. data/lib/fog/ovirt/requests/compute/get_quota.rb +0 -17
  130. data/lib/fog/ovirt/requests/compute/get_template.rb +0 -17
  131. data/lib/fog/ovirt/requests/compute/get_virtual_machine.rb +0 -17
  132. data/lib/fog/ovirt/requests/compute/list_affinity_group_vms.rb +0 -22
  133. data/lib/fog/ovirt/requests/compute/list_affinity_groups.rb +0 -20
  134. data/lib/fog/ovirt/requests/compute/list_clusters.rb +0 -19
  135. data/lib/fog/ovirt/requests/compute/list_instance_types.rb +0 -19
  136. data/lib/fog/ovirt/requests/compute/list_networks.rb +0 -16
  137. data/lib/fog/ovirt/requests/compute/list_operating_systems.rb +0 -19
  138. data/lib/fog/ovirt/requests/compute/list_quotas.rb +0 -19
  139. data/lib/fog/ovirt/requests/compute/list_template_interfaces.rb +0 -19
  140. data/lib/fog/ovirt/requests/compute/list_template_volumes.rb +0 -19
  141. data/lib/fog/ovirt/requests/compute/list_templates.rb +0 -19
  142. data/lib/fog/ovirt/requests/compute/list_virtual_machines.rb +0 -19
  143. data/lib/fog/ovirt/requests/compute/list_vm_interfaces.rb +0 -19
  144. data/lib/fog/ovirt/requests/compute/list_vm_volumes.rb +0 -19
  145. data/lib/fog/ovirt/requests/compute/list_volumes.rb +0 -19
  146. data/lib/fog/ovirt/requests/compute/remove_from_affinity_group.rb +0 -21
  147. data/lib/fog/ovirt/requests/compute/storage_domains.rb +0 -20
  148. data/lib/fog/ovirt/requests/compute/update_interface.rb +0 -35
  149. data/lib/fog/ovirt/requests/compute/update_vm.rb +0 -18
  150. data/lib/fog/ovirt/requests/compute/update_volume.rb +0 -39
  151. data/lib/fog/ovirt/requests/compute/vm_action.rb +0 -22
  152. data/lib/fog/ovirt/requests/compute/vm_start_with_cloudinit.rb +0 -19
  153. data/lib/fog/ovirt/requests/compute/vm_ticket.rb +0 -17
@@ -0,0 +1,20 @@
1
+ module Fog
2
+ module Compute
3
+ class Ovirt
4
+ class V3
5
+ class Real
6
+ def update_vm(attrs)
7
+ client.update_vm(attrs)
8
+ end
9
+ end
10
+
11
+ class Mock
12
+ def update_vm(_attrs)
13
+ xml = read_xml("vm.xml")
14
+ OVIRT::VM.new(self, Nokogiri::XML(xml).root)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,37 @@
1
+ module Fog
2
+ module Compute
3
+ class Ovirt
4
+ class V3
5
+ module Shared
6
+ def check_arguments(id, options)
7
+ raise ArgumentError, "instance id is a required parameter" unless id
8
+ raise ArgumentError, "disk id is a required parameter for update-volume" unless options.key? :id
9
+ end
10
+ end
11
+
12
+ class Real
13
+ extend ::Fog::Compute::Ovirt::V3::Shared
14
+
15
+ def update_volume(id, options)
16
+ check_arguments(id, options)
17
+
18
+ disk_id = options[:id]
19
+ options.delete(:id)
20
+
21
+ client.update_volume(id, disk_id, options)
22
+ true # If we come here, expect success and return true
23
+ end
24
+ end
25
+
26
+ class Mock
27
+ extend ::Fog::Compute::Ovirt::V3::Shared
28
+
29
+ def update_volume(id, options)
30
+ check_arguments(id, options)
31
+ true
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,24 @@
1
+ module Fog
2
+ module Compute
3
+ class Ovirt
4
+ class V3
5
+ class Real
6
+ def vm_action(options = {})
7
+ raise ArgumentError, "instance id is a required parameter" unless options.key? :id
8
+ raise ArgumentError, "action is a required parameter" unless options.key? :action
9
+
10
+ client.vm_action options[:id], options[:action]
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def vm_action(options = {})
16
+ raise ArgumentError, "id is a required parameter" unless options.key? :id
17
+ raise ArgumentError, "action is a required parameter" unless options.key? :action
18
+ true
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,21 @@
1
+ module Fog
2
+ module Compute
3
+ class Ovirt
4
+ class V3
5
+ class Real
6
+ def vm_start_with_cloudinit(options = {})
7
+ raise ArgumentError, "instance id is a required parameter" unless options.key? :id
8
+ client.vm_start_with_cloudinit(options[:id], options[:user_data])
9
+ end
10
+ end
11
+
12
+ class Mock
13
+ def vm_start_with_cloudinit(options = {})
14
+ raise ArgumentError, "instance id is a required parameter" unless options.key? :id
15
+ true
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Compute
3
+ class Ovirt
4
+ class V3
5
+ class Real
6
+ def vm_ticket(id, options = {})
7
+ client.set_ticket(id, options)
8
+ end
9
+ end
10
+
11
+ class Mock
12
+ def vm_ticket(_id, _options = {})
13
+ "Secret"
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Ovirt
3
- VERSION = '0.1.3'
3
+ VERSION = "1.0.0".freeze
4
4
  end
5
5
  end
data/tests/helper.rb CHANGED
@@ -1 +1 @@
1
- require File.expand_path('../../lib/fog/ovirt', __FILE__)
1
+ require File.expand_path("../lib/fog/ovirt", __dir__)
@@ -2,15 +2,13 @@
2
2
  #
3
3
  # FOG_MOCK=true fog
4
4
 
5
- if ENV["FOG_MOCK"] == "true"
6
- Fog.mock!
7
- end
5
+ Fog.mock! if ENV["FOG_MOCK"] == "true"
8
6
 
9
7
  # if in mocked mode, fill in some fake credentials for us
10
8
  if Fog.mock?
11
9
  Fog.credentials = {
12
- :ovirt_url => 'http://ovirt:8080/api',
13
- :ovirt_username => 'admin@internal',
14
- :ovirt_password => '123123'
10
+ :ovirt_url => "http://ovirt:8080/api",
11
+ :ovirt_username => "admin@internal",
12
+ :ovirt_password => "123123"
15
13
  }.merge(Fog.credentials)
16
14
  end
@@ -1,7 +1,7 @@
1
1
  module Shindo
2
2
  class Tests
3
3
  def succeeds
4
- test('succeeds') do
4
+ test("succeeds") do
5
5
  !!instance_eval(&Proc.new)
6
6
  end
7
7
  end
@@ -1,24 +1,23 @@
1
- Shindo.tests('Fog::Compute[:ovirt]', ['ovirt']) do
2
-
1
+ Shindo.tests("Fog::Compute[:ovirt]", ["ovirt"]) do
3
2
  compute = Fog::Compute[:ovirt]
4
3
 
5
4
  tests("Compute attributes") do
6
- %w{ ovirt_attrs }.each do |attr|
5
+ %w[ovirt_attrs].each do |attr|
7
6
  test("it should respond to #{attr}") { compute.respond_to? attr }
8
7
  end
9
8
  end
10
9
 
11
10
  tests("Compute collections") do
12
- %w{ servers templates clusters interfaces operating_systems }.each do |collection|
11
+ %w[servers templates clusters interfaces operating_systems].each do |collection|
13
12
  test("it should respond to #{collection}") { compute.respond_to? collection }
14
13
  end
15
14
  end
16
15
 
17
16
  tests("Compute requests") do
18
- %w{ add_interface create_vm datacenters destroy_interface destroy_vm get_cluster get_template
17
+ %w[ add_interface create_vm datacenters destroy_interface destroy_vm get_cluster get_template
19
18
  get_virtual_machine list_clusters list_networks list_template_interfaces list_templates
20
19
  list_virtual_machines list_vm_interfaces storage_domains update_interface update_vm vm_action
21
- api_version update_volume}.each do |collection|
20
+ api_version update_volume].each do |collection|
22
21
  test("it should respond to #{collection}") { compute.respond_to? collection }
23
22
  end
24
23
  end
@@ -1,31 +1,28 @@
1
- Shindo.tests('Fog::Compute[:ovirt] | cluster model', ['ovirt']) do
2
-
1
+ Shindo.tests("Fog::Compute[:ovirt] | cluster model", ["ovirt"]) do
3
2
  clusters = Fog::Compute[:ovirt].clusters
4
3
  cluster = clusters.last
5
4
 
6
- tests('The cluster model should') do
7
- tests('have the action') do
8
- test('reload') { cluster.respond_to? 'reload' }
9
- %w{ networks }.each do |action|
5
+ tests("The cluster model should") do
6
+ tests("have the action") do
7
+ test("reload") { cluster.respond_to? "reload" }
8
+ %w[networks].each do |action|
10
9
  test(action) { cluster.respond_to? action }
11
10
  end
12
11
  end
13
- tests('have attributes') do
12
+ tests("have attributes") do
14
13
  model_attribute_hash = cluster.attributes
15
- attributes = [ :id,
16
- :name]
14
+ attributes = %i[id name]
17
15
  tests("The cluster model should respond to") do
18
16
  attributes.each do |attribute|
19
- test("#{attribute}") { cluster.respond_to? attribute }
17
+ test(attribute.to_s) { cluster.respond_to? attribute }
20
18
  end
21
19
  end
22
20
  tests("The attributes hash should have key") do
23
21
  attributes.each do |attribute|
24
- test("#{attribute}") { model_attribute_hash.key? attribute }
22
+ test(attribute.to_s) { model_attribute_hash.key? attribute }
25
23
  end
26
24
  end
27
25
  end
28
- test('be a kind of Fog::Compute::Ovirt::Cluster') { cluster.kind_of? Fog::Compute::Ovirt::Cluster }
26
+ test("be a kind of Fog::Compute::Ovirt::Cluster") { cluster.is_a? Fog::Compute::Ovirt::Cluster }
29
27
  end
30
-
31
28
  end
@@ -1,9 +1,7 @@
1
- Shindo.tests('Fog::Compute[:ovirt] | clusters collection', ['ovirt']) do
2
-
1
+ Shindo.tests("Fog::Compute[:ovirt] | clusters collection", ["ovirt"]) do
3
2
  clusters = Fog::Compute[:ovirt].clusters
4
3
 
5
- tests('The clusters collection') do
6
- test('should be a kind of Fog::Compute::Ovirt::Clusters') { clusters.kind_of? Fog::Compute::Ovirt::Clusters }
4
+ tests("The clusters collection") do
5
+ test("should be a kind of Fog::Compute::Ovirt::Clusters") { clusters.is_a? Fog::Compute::Ovirt::Clusters }
7
6
  end
8
-
9
7
  end
@@ -1,27 +1,25 @@
1
- Shindo.tests('Fog::Compute[:ovirt] | interface model', ['ovirt']) do
2
-
1
+ Shindo.tests("Fog::Compute[:ovirt] | interface model", ["ovirt"]) do
3
2
  interfaces = Fog::Compute[:ovirt].servers.last.interfaces
4
3
  interface = interfaces.last
5
4
 
6
- tests('The interface model should') do
7
- tests('have the action') do
8
- test('reload') { interface.respond_to? 'reload' }
5
+ tests("The interface model should") do
6
+ tests("have the action") do
7
+ test("reload") { interface.respond_to? "reload" }
9
8
  end
10
- tests('have attributes') do
9
+ tests("have attributes") do
11
10
  model_attribute_hash = interface.attributes
12
- attributes = [ :id, :name, :network]
11
+ attributes = %i[id name network]
13
12
  tests("The interface model should respond to") do
14
13
  attributes.each do |attribute|
15
- test("#{attribute}") { interface.respond_to? attribute }
14
+ test(attribute.to_s) { interface.respond_to? attribute }
16
15
  end
17
16
  end
18
17
  tests("The attributes hash should have key") do
19
18
  attributes.each do |attribute|
20
- test("#{attribute}") { model_attribute_hash.key? attribute }
19
+ test(attribute.to_s) { model_attribute_hash.key? attribute }
21
20
  end
22
21
  end
23
22
  end
24
- test('be a kind of Fog::Compute::Ovirt::Interface') { interface.kind_of? Fog::Compute::Ovirt::Interface }
23
+ test("be a kind of Fog::Compute::Ovirt::Interface") { interface.is_a? Fog::Compute::Ovirt::Interface }
25
24
  end
26
-
27
25
  end
@@ -1,9 +1,7 @@
1
- Shindo.tests('Fog::Compute[:ovirt] | interfaces collection', ['ovirt']) do
2
-
1
+ Shindo.tests("Fog::Compute[:ovirt] | interfaces collection", ["ovirt"]) do
3
2
  interfaces = Fog::Compute[:ovirt].interfaces
4
3
 
5
- tests('The interfaces collection') do
6
- test('should be a kind of Fog::Compute::Ovirt::Interfaces') { interfaces.kind_of? Fog::Compute::Ovirt::Interfaces }
4
+ tests("The interfaces collection") do
5
+ test("should be a kind of Fog::Compute::Ovirt::Interfaces") { interfaces.is_a? Fog::Compute::Ovirt::Interfaces }
7
6
  end
8
-
9
7
  end
@@ -1,29 +1,23 @@
1
- Shindo.tests('Fog::Compute[:ovirt] | operating_system model', ['ovirt']) do
2
-
1
+ Shindo.tests("Fog::Compute[:ovirt] | operating_system model", ["ovirt"]) do
3
2
  operating_systems = Fog::Compute[:ovirt].operating_systems
4
3
  operating_system = operating_systems.last
5
4
 
6
- tests('The operating_system model should') do
7
- tests('have attributes') do
5
+ tests("The operating_system model should") do
6
+ tests("have attributes") do
8
7
  model_attribute_hash = operating_system.attributes
9
- attributes = [ :id,
10
- :name,
11
- :href,
12
- :description
13
- ]
8
+ attributes = %i[id name href description]
14
9
 
15
10
  tests("The operating_system model should respond to") do
16
11
  attributes.each do |attribute|
17
- test("#{attribute}") { operating_system.respond_to? attribute }
12
+ test(attribute.to_s) { operating_system.respond_to? attribute }
18
13
  end
19
14
  end
20
15
  tests("The attributes hash should have key") do
21
16
  attributes.each do |attribute|
22
- test("#{attribute}") { model_attribute_hash.key? attribute }
17
+ test(attribute.to_s) { model_attribute_hash.key? attribute }
23
18
  end
24
19
  end
25
20
  end
26
- test('be a kind of Fog::Compute::Ovirt::OperatingSystem') { operating_system.kind_of? Fog::Compute::Ovirt::OperatingSystem }
21
+ test("be a kind of Fog::Compute::Ovirt::OperatingSystem") { operating_system.is_a? Fog::Compute::Ovirt::OperatingSystem }
27
22
  end
28
-
29
23
  end
@@ -1,10 +1,8 @@
1
- Shindo.tests('Fog::Compute[:ovirt] | operating_systems collection', ['ovirt']) do
2
-
1
+ Shindo.tests("Fog::Compute[:ovirt] | operating_systems collection", ["ovirt"]) do
3
2
  operating_systems = Fog::Compute[:ovirt].operating_systems
4
3
 
5
- tests('The servers collection') do
6
- test('should not be empty') { not operating_systems.empty? }
7
- test('should be a kind of Fog::Compute::Ovirt::OperatingSystems') { operating_systems.kind_of? Fog::Compute::Ovirt::OperatingSystems }
4
+ tests("The servers collection") do
5
+ test("should not be empty") { !operating_systems.empty? }
6
+ test("should be a kind of Fog::Compute::Ovirt::OperatingSystems") { operating_systems.is_a? Fog::Compute::Ovirt::OperatingSystems }
8
7
  end
9
-
10
8
  end
@@ -1,51 +1,48 @@
1
- Shindo.tests('Fog::Compute[:ovirt] | server model', ['ovirt']) do
2
-
1
+ # rubocop:disable Metrics/BlockLength
2
+ Shindo.tests("Fog::Compute[:ovirt] | server model", ["ovirt"]) do
3
3
  servers = Fog::Compute[:ovirt].servers
4
4
  server = servers.last
5
5
 
6
- tests('The server model should') do
7
- tests('have the action') do
8
- test('reload') { server.respond_to? 'reload' }
9
- %w{ start stop destroy reboot suspend }.each do |action|
6
+ tests("The server model should") do
7
+ tests("have the action") do
8
+ test("reload") { server.respond_to? "reload" }
9
+ %w[start stop destroy reboot suspend].each do |action|
10
10
  test(action) { server.respond_to? action }
11
11
  end
12
- %w{ start reboot suspend stop }.each do |action|
13
- test("#{action} returns successfully") {
14
- begin
15
- server.send(action.to_sym) ? true : false
16
- rescue OVIRT::OvirtException
17
- #ovirt exceptions are acceptable for the above actions.
18
- true
19
- end
20
- }
12
+ %w[start reboot suspend stop].each do |action|
13
+ test("#{action} returns successfully") do
14
+ server.send(action.to_sym) ? true : false
15
+ end
21
16
  end
22
17
  end
23
- tests('have attributes') do
18
+ tests("have attributes") do
24
19
  model_attribute_hash = server.attributes
25
- attributes = [ :id,
26
- :name,
27
- :description,
28
- :profile,
29
- :display,
30
- :creation_time,
31
- :os,
32
- :status,
33
- :cores,
34
- :memory,
35
- :cluster,
36
- :template]
20
+ attributes = %i[
21
+ id
22
+ name
23
+ description
24
+ profile
25
+ display
26
+ creation_time
27
+ os
28
+ status
29
+ cores
30
+ memory
31
+ cluster
32
+ template
33
+ ]
37
34
  tests("The server model should respond to") do
38
35
  attributes.each do |attribute|
39
- test("#{attribute}") { server.respond_to? attribute }
36
+ test(attribute.to_s) { server.respond_to? attribute }
40
37
  end
41
38
  end
42
39
  tests("The attributes hash should have key") do
43
40
  attributes.each do |attribute|
44
- test("#{attribute}") { model_attribute_hash.key? attribute }
41
+ test(attribute.to_s) { model_attribute_hash.key? attribute }
45
42
  end
46
43
  end
47
44
  end
48
- test('be a kind of Fog::Compute::Ovirt::Server') { server.kind_of? Fog::Compute::Ovirt::Server }
45
+ test("be a kind of Fog::Compute::Ovirt::Server") { server.is_a? Fog::Compute::Ovirt::Server }
49
46
  end
50
-
51
47
  end
48
+ # rubocop:enable Metrics/BlockLength