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.
- checksums.yaml +4 -4
- data/.rubocop.yml +20 -0
- data/.rubocop_todo.yml +43 -0
- data/.travis.yml +3 -1
- data/Gemfile +1 -1
- data/Rakefile +15 -5
- data/fog-ovirt.gemspec +15 -14
- data/lib/fog/bin/ovirt.rb +1 -1
- data/lib/fog/ovirt.rb +1 -1
- data/lib/fog/ovirt/compute.rb +56 -112
- data/lib/fog/ovirt/compute/v3.rb +137 -0
- data/lib/fog/ovirt/core.rb +13 -4
- data/lib/fog/ovirt/models/compute/affinity_group.rb +2 -2
- data/lib/fog/ovirt/models/compute/affinity_groups.rb +2 -2
- data/lib/fog/ovirt/models/compute/clusters.rb +2 -2
- data/lib/fog/ovirt/models/compute/instance_types.rb +2 -2
- data/lib/fog/ovirt/models/compute/interfaces.rb +7 -5
- data/lib/fog/ovirt/models/compute/operating_systems.rb +3 -3
- data/lib/fog/ovirt/models/compute/quotas.rb +3 -3
- data/lib/fog/ovirt/models/compute/server.rb +37 -31
- data/lib/fog/ovirt/models/compute/servers.rb +2 -2
- data/lib/fog/ovirt/models/compute/template.rb +9 -9
- data/lib/fog/ovirt/models/compute/templates.rb +2 -2
- data/lib/fog/ovirt/models/compute/volume.rb +3 -3
- data/lib/fog/ovirt/models/compute/volumes.rb +6 -4
- data/lib/fog/ovirt/requests/compute/v3/activate_volume.rb +23 -0
- data/lib/fog/ovirt/requests/compute/v3/add_interface.rb +22 -0
- data/lib/fog/ovirt/requests/compute/v3/add_to_affinity_group.rb +23 -0
- data/lib/fog/ovirt/requests/compute/v3/add_volume.rb +23 -0
- data/lib/fog/ovirt/requests/compute/v3/attach_volume.rb +24 -0
- data/lib/fog/ovirt/requests/compute/v3/create_affinity_group.rb +20 -0
- data/lib/fog/ovirt/requests/compute/v3/create_vm.rb +20 -0
- data/lib/fog/ovirt/requests/compute/v3/datacenters.rb +22 -0
- data/lib/fog/ovirt/requests/compute/v3/deactivate_volume.rb +24 -0
- data/lib/fog/ovirt/requests/compute/v3/destroy_affinity_group.rb +21 -0
- data/lib/fog/ovirt/requests/compute/v3/destroy_interface.rb +24 -0
- data/lib/fog/ovirt/requests/compute/v3/destroy_vm.rb +21 -0
- data/lib/fog/ovirt/requests/compute/v3/destroy_volume.rb +24 -0
- data/lib/fog/ovirt/requests/compute/v3/detach_volume.rb +24 -0
- data/lib/fog/ovirt/requests/compute/v3/get_affinity_group.rb +20 -0
- data/lib/fog/ovirt/requests/compute/v3/get_api_version.rb +18 -0
- data/lib/fog/ovirt/requests/compute/v3/get_cluster.rb +19 -0
- data/lib/fog/ovirt/requests/compute/v3/get_instance_type.rb +19 -0
- data/lib/fog/ovirt/requests/compute/v3/get_quota.rb +19 -0
- data/lib/fog/ovirt/requests/compute/v3/get_template.rb +19 -0
- data/lib/fog/ovirt/requests/compute/v3/get_virtual_machine.rb +19 -0
- data/lib/fog/ovirt/requests/compute/v3/list_affinity_group_vms.rb +24 -0
- data/lib/fog/ovirt/requests/compute/v3/list_affinity_groups.rb +22 -0
- data/lib/fog/ovirt/requests/compute/v3/list_clusters.rb +21 -0
- data/lib/fog/ovirt/requests/compute/v3/list_instance_types.rb +21 -0
- data/lib/fog/ovirt/requests/compute/v3/list_networks.rb +18 -0
- data/lib/fog/ovirt/requests/compute/v3/list_operating_systems.rb +21 -0
- data/lib/fog/ovirt/requests/compute/v3/list_quotas.rb +21 -0
- data/lib/fog/ovirt/requests/compute/v3/list_template_interfaces.rb +21 -0
- data/lib/fog/ovirt/requests/compute/v3/list_template_volumes.rb +21 -0
- data/lib/fog/ovirt/requests/compute/v3/list_templates.rb +21 -0
- data/lib/fog/ovirt/requests/compute/v3/list_virtual_machines.rb +21 -0
- data/lib/fog/ovirt/requests/compute/v3/list_vm_interfaces.rb +21 -0
- data/lib/fog/ovirt/requests/compute/v3/list_vm_volumes.rb +21 -0
- data/lib/fog/ovirt/requests/compute/v3/list_volumes.rb +21 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/affinitygroup.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/affinitygroup_vms.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/affinitygroups.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/cluster.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/clusters.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/data_centers.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/disks.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/instance_type.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/instance_types.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/nics.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/operating_systems.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/quotas.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/storage_domains.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/template.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/templates.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/vm.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/vms.xml +0 -0
- data/lib/fog/ovirt/requests/compute/{mock_files → v3/mock_files}/volumes.xml +0 -0
- data/lib/fog/ovirt/requests/compute/v3/remove_from_affinity_group.rb +23 -0
- data/lib/fog/ovirt/requests/compute/v3/storage_domains.rb +22 -0
- data/lib/fog/ovirt/requests/compute/v3/update_interface.rb +36 -0
- data/lib/fog/ovirt/requests/compute/v3/update_vm.rb +20 -0
- data/lib/fog/ovirt/requests/compute/v3/update_volume.rb +37 -0
- data/lib/fog/ovirt/requests/compute/v3/vm_action.rb +24 -0
- data/lib/fog/ovirt/requests/compute/v3/vm_start_with_cloudinit.rb +21 -0
- data/lib/fog/ovirt/requests/compute/v3/vm_ticket.rb +19 -0
- data/lib/fog/ovirt/version.rb +1 -1
- data/tests/helper.rb +1 -1
- data/tests/helpers/mock_helper.rb +4 -6
- data/tests/helpers/succeeds_helper.rb +1 -1
- data/tests/ovirt/compute_tests.rb +5 -6
- data/tests/ovirt/models/compute/cluster_tests.rb +10 -13
- data/tests/ovirt/models/compute/clusters_tests.rb +3 -5
- data/tests/ovirt/models/compute/interface_tests.rb +9 -11
- data/tests/ovirt/models/compute/interfaces_tests.rb +3 -5
- data/tests/ovirt/models/compute/operating_system_tests.rb +7 -13
- data/tests/ovirt/models/compute/operating_systems_tests.rb +4 -6
- data/tests/ovirt/models/compute/server_tests.rb +29 -32
- data/tests/ovirt/models/compute/servers_tests.rb +7 -9
- data/tests/ovirt/models/compute/template_tests.rb +10 -12
- data/tests/ovirt/models/compute/templates_tests.rb +3 -5
- data/tests/ovirt/requests/compute/client_tests.rb +31 -0
- data/tests/ovirt/requests/compute/create_vm_tests.rb +7 -16
- data/tests/ovirt/requests/compute/destroy_vm_tests.rb +8 -10
- data/tests/ovirt/requests/compute/list_datacenters_tests.rb +3 -5
- data/tests/ovirt/requests/compute/list_quotas_tests.rb +2 -4
- data/tests/ovirt/requests/compute/list_storage_domains_tests.rb +3 -5
- data/tests/ovirt/requests/compute/update_vm_tests.rb +9 -11
- data/tests/ovirt/requests/compute/update_volume_tests.rb +9 -12
- metadata +70 -65
- data/lib/fog/ovirt/requests/compute/activate_volume.rb +0 -22
- data/lib/fog/ovirt/requests/compute/add_interface.rb +0 -20
- data/lib/fog/ovirt/requests/compute/add_to_affinity_group.rb +0 -21
- data/lib/fog/ovirt/requests/compute/add_volume.rb +0 -21
- data/lib/fog/ovirt/requests/compute/attach_volume.rb +0 -22
- data/lib/fog/ovirt/requests/compute/create_affinity_group.rb +0 -18
- data/lib/fog/ovirt/requests/compute/create_vm.rb +0 -18
- data/lib/fog/ovirt/requests/compute/datacenters.rb +0 -20
- data/lib/fog/ovirt/requests/compute/deactivate_volume.rb +0 -22
- data/lib/fog/ovirt/requests/compute/destroy_affinity_group.rb +0 -19
- data/lib/fog/ovirt/requests/compute/destroy_interface.rb +0 -22
- data/lib/fog/ovirt/requests/compute/destroy_vm.rb +0 -19
- data/lib/fog/ovirt/requests/compute/destroy_volume.rb +0 -22
- data/lib/fog/ovirt/requests/compute/detach_volume.rb +0 -22
- data/lib/fog/ovirt/requests/compute/get_affinity_group.rb +0 -18
- data/lib/fog/ovirt/requests/compute/get_api_version.rb +0 -16
- data/lib/fog/ovirt/requests/compute/get_cluster.rb +0 -17
- data/lib/fog/ovirt/requests/compute/get_instance_type.rb +0 -17
- data/lib/fog/ovirt/requests/compute/get_quota.rb +0 -17
- data/lib/fog/ovirt/requests/compute/get_template.rb +0 -17
- data/lib/fog/ovirt/requests/compute/get_virtual_machine.rb +0 -17
- data/lib/fog/ovirt/requests/compute/list_affinity_group_vms.rb +0 -22
- data/lib/fog/ovirt/requests/compute/list_affinity_groups.rb +0 -20
- data/lib/fog/ovirt/requests/compute/list_clusters.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_instance_types.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_networks.rb +0 -16
- data/lib/fog/ovirt/requests/compute/list_operating_systems.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_quotas.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_template_interfaces.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_template_volumes.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_templates.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_virtual_machines.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_vm_interfaces.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_vm_volumes.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_volumes.rb +0 -19
- data/lib/fog/ovirt/requests/compute/remove_from_affinity_group.rb +0 -21
- data/lib/fog/ovirt/requests/compute/storage_domains.rb +0 -20
- data/lib/fog/ovirt/requests/compute/update_interface.rb +0 -35
- data/lib/fog/ovirt/requests/compute/update_vm.rb +0 -18
- data/lib/fog/ovirt/requests/compute/update_volume.rb +0 -39
- data/lib/fog/ovirt/requests/compute/vm_action.rb +0 -22
- data/lib/fog/ovirt/requests/compute/vm_start_with_cloudinit.rb +0 -19
- 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
|
data/lib/fog/ovirt/version.rb
CHANGED
data/tests/helper.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require File.expand_path(
|
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
|
-
|
13
|
-
|
14
|
-
|
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,24 +1,23 @@
|
|
1
|
-
Shindo.tests(
|
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
|
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
|
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
|
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
|
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(
|
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(
|
7
|
-
tests(
|
8
|
-
test(
|
9
|
-
%w
|
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(
|
12
|
+
tests("have attributes") do
|
14
13
|
model_attribute_hash = cluster.attributes
|
15
|
-
attributes = [
|
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(
|
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(
|
22
|
+
test(attribute.to_s) { model_attribute_hash.key? attribute }
|
25
23
|
end
|
26
24
|
end
|
27
25
|
end
|
28
|
-
test(
|
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(
|
2
|
-
|
1
|
+
Shindo.tests("Fog::Compute[:ovirt] | clusters collection", ["ovirt"]) do
|
3
2
|
clusters = Fog::Compute[:ovirt].clusters
|
4
3
|
|
5
|
-
tests(
|
6
|
-
test(
|
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(
|
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(
|
7
|
-
tests(
|
8
|
-
test(
|
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(
|
9
|
+
tests("have attributes") do
|
11
10
|
model_attribute_hash = interface.attributes
|
12
|
-
attributes = [
|
11
|
+
attributes = %i[id name network]
|
13
12
|
tests("The interface model should respond to") do
|
14
13
|
attributes.each do |attribute|
|
15
|
-
test(
|
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(
|
19
|
+
test(attribute.to_s) { model_attribute_hash.key? attribute }
|
21
20
|
end
|
22
21
|
end
|
23
22
|
end
|
24
|
-
test(
|
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(
|
2
|
-
|
1
|
+
Shindo.tests("Fog::Compute[:ovirt] | interfaces collection", ["ovirt"]) do
|
3
2
|
interfaces = Fog::Compute[:ovirt].interfaces
|
4
3
|
|
5
|
-
tests(
|
6
|
-
test(
|
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(
|
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(
|
7
|
-
tests(
|
5
|
+
tests("The operating_system model should") do
|
6
|
+
tests("have attributes") do
|
8
7
|
model_attribute_hash = operating_system.attributes
|
9
|
-
attributes = [
|
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(
|
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(
|
17
|
+
test(attribute.to_s) { model_attribute_hash.key? attribute }
|
23
18
|
end
|
24
19
|
end
|
25
20
|
end
|
26
|
-
test(
|
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(
|
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(
|
6
|
-
test(
|
7
|
-
test(
|
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
|
-
|
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(
|
7
|
-
tests(
|
8
|
-
test(
|
9
|
-
%w
|
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
|
13
|
-
test("#{action} returns successfully")
|
14
|
-
|
15
|
-
|
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(
|
18
|
+
tests("have attributes") do
|
24
19
|
model_attribute_hash = server.attributes
|
25
|
-
attributes = [
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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(
|
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(
|
41
|
+
test(attribute.to_s) { model_attribute_hash.key? attribute }
|
45
42
|
end
|
46
43
|
end
|
47
44
|
end
|
48
|
-
test(
|
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
|