fog-vsphere 1.7.0 → 1.7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +2 -1
- data/.rubocop.yml +8 -0
- data/.rubocop_todo.yml +217 -0
- data/.travis.yml +6 -7
- data/CHANGELOG.md +2 -6
- data/CONTRIBUTORS.md +10 -0
- data/Rakefile +10 -1
- data/lib/fog/vsphere/compute.rb +0 -2
- data/lib/fog/vsphere/models/compute/scsicontroller.rb +1 -6
- data/lib/fog/vsphere/models/compute/server.rb +7 -29
- data/lib/fog/vsphere/models/compute/ticket.rb +16 -0
- data/lib/fog/vsphere/models/compute/tickets.rb +25 -0
- data/lib/fog/vsphere/models/compute/volume.rb +28 -46
- data/lib/fog/vsphere/models/compute/volumes.rb +1 -1
- data/lib/fog/vsphere/requests/compute/create_vm.rb +44 -32
- data/lib/fog/vsphere/requests/compute/host_finish_maintenance.rb +14 -0
- data/lib/fog/vsphere/requests/compute/host_shutdown.rb +14 -0
- data/lib/fog/vsphere/requests/compute/host_start_maintenance.rb +14 -0
- data/lib/fog/vsphere/requests/compute/list_vm_scsi_controllers.rb +11 -4
- data/lib/fog/vsphere/requests/compute/list_vm_volumes.rb +1 -2
- data/lib/fog/vsphere/requests/compute/modify_vm_controller.rb +14 -2
- data/lib/fog/vsphere/requests/compute/modify_vm_volume.rb +3 -3
- data/lib/fog/vsphere/requests/compute/vm_acquire_ticket.rb +34 -0
- data/lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb +15 -26
- data/lib/fog/vsphere/requests/compute/vm_relocate.rb +54 -0
- data/lib/fog/vsphere/requests/compute/vm_remove_snapshot.rb +29 -0
- data/lib/fog/vsphere/requests/compute/vm_rename.rb +24 -0
- data/lib/fog/vsphere/requests/compute/vm_revert_snapshot.rb +29 -0
- data/lib/fog/vsphere/requests/compute/vm_suspend.rb +54 -0
- data/lib/fog/vsphere/version.rb +1 -1
- data/tests/class_from_string_tests.rb +3 -3
- data/tests/compute_tests.rb +16 -17
- data/tests/helpers/mock_helper.rb +3 -3
- data/tests/models/compute/cluster_tests.rb +4 -5
- data/tests/models/compute/hosts_tests.rb +2 -4
- data/tests/models/compute/rules_tests.rb +10 -16
- data/tests/models/compute/server_tests.rb +33 -29
- data/tests/models/compute/servers_tests.rb +2 -4
- data/tests/models/compute/ticket_tests.rb +12 -0
- data/tests/models/compute/tickets_tests.rb +8 -0
- data/tests/requests/compute/current_time_tests.rb +2 -4
- data/tests/requests/compute/folder_destroy_tests.rb +5 -7
- data/tests/requests/compute/get_network_tests.rb +18 -22
- data/tests/requests/compute/list_child_snapshots_tests.rb +1 -2
- data/tests/requests/compute/list_clusters_tests.rb +5 -6
- data/tests/requests/compute/list_datastores_tests.rb +6 -7
- data/tests/requests/compute/list_hosts_tests.rb +3 -4
- data/tests/requests/compute/list_networks_tests.rb +6 -7
- data/tests/requests/compute/list_storage_pods_test.rb +3 -4
- data/tests/requests/compute/list_virtual_machines_tests.rb +16 -20
- data/tests/requests/compute/list_vm_cdroms_tests.rb +1 -2
- data/tests/requests/compute/list_vm_snapshots_tests.rb +1 -2
- data/tests/requests/compute/modify_vm_cdrom_tests.rb +3 -4
- data/tests/requests/compute/revert_to_snapshot_tests.rb +2 -4
- data/tests/requests/compute/set_vm_customvalue_tests.rb +0 -2
- data/tests/requests/compute/vm_clone_tests.rb +20 -20
- data/tests/requests/compute/vm_config_vnc_tests.rb +3 -4
- data/tests/requests/compute/vm_destroy_tests.rb +1 -4
- data/tests/requests/compute/vm_migrate_tests.rb +1 -2
- data/tests/requests/compute/vm_power_off_tests.rb +2 -4
- data/tests/requests/compute/vm_power_on_tests.rb +1 -3
- data/tests/requests/compute/vm_reboot_tests.rb +2 -4
- data/tests/requests/compute/vm_reconfig_cdrom_tests.rb +2 -3
- data/tests/requests/compute/vm_reconfig_cpus_tests.rb +1 -3
- data/tests/requests/compute/vm_reconfig_hardware_tests.rb +2 -4
- data/tests/requests/compute/vm_reconfig_memory_tests.rb +1 -3
- data/tests/requests/compute/vm_suspend_tests.rb +23 -0
- data/tests/requests/compute/vm_take_snapshot_tests.rb +1 -3
- metadata +22 -4
- data/gemfiles/Gemfile.1.9.2+ +0 -9
@@ -1,13 +1,11 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | hosts collection', ['vsphere']) do
|
2
|
-
|
3
2
|
compute = Fog::Compute[:vsphere]
|
4
3
|
cluster = compute.datacenters.first.clusters.get('Solutionscluster')
|
5
4
|
hosts = cluster.hosts
|
6
5
|
|
7
6
|
tests('The hosts collection') do
|
8
|
-
test('should not be empty') {
|
9
|
-
test('should be a kind of Fog::Compute::Vsphere::Hosts') { hosts.
|
7
|
+
test('should not be empty') { !hosts.empty? }
|
8
|
+
test('should be a kind of Fog::Compute::Vsphere::Hosts') { hosts.is_a? Fog::Compute::Vsphere::Hosts }
|
10
9
|
test('should get hosts') { hosts.get('host1.example.com').name == 'host1.example.com' }
|
11
10
|
end
|
12
|
-
|
13
11
|
end
|
@@ -1,34 +1,28 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | rules collection', ['vsphere']) do
|
2
|
-
|
3
2
|
compute = Fog::Compute[:vsphere]
|
4
3
|
cluster = compute.datacenters.first.clusters.get('Solutionscluster')
|
5
4
|
servers = compute.servers
|
6
5
|
rules = cluster.rules
|
7
|
-
|
6
|
+
|
8
7
|
tests('The rules collection') do
|
9
|
-
test('should not be empty') {
|
10
|
-
test('should be a kind of Fog::Compute::Vsphere::Rules') { rules.
|
8
|
+
test('should not be empty') { !rules.empty? }
|
9
|
+
test('should be a kind of Fog::Compute::Vsphere::Rules') { rules.is_a? Fog::Compute::Vsphere::Rules }
|
11
10
|
test('should get rules') { rules.get('anti-affinity-foo').key == 4242 }
|
12
11
|
test('should destroy rules') { rules.first.destroy; rules.reload; rules.empty? }
|
13
12
|
test('should create rules') do
|
14
|
-
r = rules.new(
|
15
|
-
|
16
|
-
|
17
|
-
type: RbVmomi::VIM::ClusterAffinityRuleSpec
|
18
|
-
})
|
13
|
+
r = rules.new(name: 'affinity-foo',
|
14
|
+
enabled: true,
|
15
|
+
type: RbVmomi::VIM::ClusterAffinityRuleSpec)
|
19
16
|
r.vms = [servers.get('5032c8a5-9c5e-ba7a-3804-832a03e16381'), servers.get('502916a3-b42e-17c7-43ce-b3206e9524dc')]
|
20
17
|
r.save
|
21
18
|
rules.reload
|
22
19
|
rules.get('affinity-foo').key > 0
|
23
20
|
end
|
24
21
|
raises(ArgumentError, 'should not create rules with <2 vms') do
|
25
|
-
rules.create(
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
vm_ids: ['5032c8a5-9c5e-ba7a-3804-832a03e16381']
|
30
|
-
})
|
22
|
+
rules.create(name: 'affinity-foo',
|
23
|
+
enabled: true,
|
24
|
+
type: RbVmomi::VIM::ClusterAffinityRuleSpec,
|
25
|
+
vm_ids: ['5032c8a5-9c5e-ba7a-3804-832a03e16381'])
|
31
26
|
end
|
32
27
|
end
|
33
|
-
|
34
28
|
end
|
@@ -5,66 +5,70 @@ Shindo.tests('Fog::Compute[:vsphere] | server model', ['vsphere']) do
|
|
5
5
|
tests('The server model should') do
|
6
6
|
tests('have the action') do
|
7
7
|
test('reload') { server.respond_to? 'reload' }
|
8
|
-
%w
|
8
|
+
%w[stop suspend destroy reboot].each do |action|
|
9
9
|
test(action) { server.respond_to? action }
|
10
10
|
test("#{action} returns successfully") { server.send(action.to_sym) ? true : false }
|
11
11
|
end
|
12
|
+
test('start') { server.respond_to?('start') }
|
13
|
+
test('start returns false, because it is already poweredOn') { server.start ? true : false }
|
12
14
|
test('guest_processes') { server.respond_to? 'guest_processes' }
|
13
15
|
test('take_snapshot') do
|
14
|
-
test('responds') { server.respond_to? 'take_snapshot'}
|
15
|
-
test('returns successfully') { server.take_snapshot('name' => 'foobar').
|
16
|
+
test('responds') { server.respond_to? 'take_snapshot' }
|
17
|
+
test('returns successfully') { server.take_snapshot('name' => 'foobar').is_a? Hash }
|
16
18
|
end
|
17
19
|
test('snapshots') do
|
18
|
-
test('responds') { server.respond_to? 'snapshots'}
|
19
|
-
test('returns successfully') { server.snapshots.
|
20
|
+
test('responds') { server.respond_to? 'snapshots' }
|
21
|
+
test('returns successfully') { server.snapshots.is_a? Fog::Compute::Vsphere::Snapshots }
|
20
22
|
end
|
21
23
|
test('find_snapshot') do
|
22
|
-
test('responds') { server.respond_to? 'find_snapshot'}
|
24
|
+
test('responds') { server.respond_to? 'find_snapshot' }
|
23
25
|
test('returns successfully') do
|
24
|
-
server.find_snapshot('snapshot-0101').
|
26
|
+
server.find_snapshot('snapshot-0101').is_a? Fog::Compute::Vsphere::Snapshot
|
25
27
|
end
|
26
28
|
test('returns correct snapshot') do
|
27
29
|
server.find_snapshot('snapshot-0101').ref == 'snapshot-0101'
|
28
30
|
end
|
29
31
|
end
|
30
32
|
tests('revert_snapshot') do
|
31
|
-
test('responds') { server.respond_to? 'revert_snapshot'}
|
33
|
+
test('responds') { server.respond_to? 'revert_snapshot' }
|
32
34
|
tests('returns correctly') do
|
33
|
-
test('when correct input given') { server.revert_snapshot('snapshot-0101').
|
35
|
+
test('when correct input given') { server.revert_snapshot('snapshot-0101').is_a? Hash }
|
34
36
|
test('when incorrect input given') do
|
35
37
|
raises(ArgumentError) { server.revert_snapshot(1) }
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
41
|
+
test('tickets') do
|
42
|
+
test('acquire ticket successfully') { server.acquire_ticket.is_a? Fog::Compute::Vsphere::Ticket }
|
43
|
+
end
|
39
44
|
end
|
40
45
|
tests('have attributes') do
|
41
46
|
model_attribute_hash = server.attributes
|
42
|
-
attributes = [
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
tests(
|
47
|
+
attributes = %i[id
|
48
|
+
instance_uuid
|
49
|
+
uuid
|
50
|
+
power_state
|
51
|
+
tools_state
|
52
|
+
mo_ref
|
53
|
+
tools_version
|
54
|
+
hostname
|
55
|
+
mac_addresses
|
56
|
+
operatingsystem
|
57
|
+
connection_state
|
58
|
+
hypervisor
|
59
|
+
name
|
60
|
+
public_ip_address]
|
61
|
+
tests('The server model should respond to') do
|
57
62
|
attributes.each do |attribute|
|
58
|
-
test(
|
63
|
+
test(attribute.to_s) { server.respond_to? attribute }
|
59
64
|
end
|
60
65
|
end
|
61
|
-
tests(
|
66
|
+
tests('The attributes hash should have key') do
|
62
67
|
attributes.each do |attribute|
|
63
|
-
test(
|
68
|
+
test(attribute.to_s) { model_attribute_hash.key? attribute }
|
64
69
|
end
|
65
70
|
end
|
66
71
|
end
|
67
|
-
test('be a kind of Fog::Compute::Vsphere::Server') { server.
|
72
|
+
test('be a kind of Fog::Compute::Vsphere::Server') { server.is_a? Fog::Compute::Vsphere::Server }
|
68
73
|
end
|
69
|
-
|
70
74
|
end
|
@@ -1,15 +1,13 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | servers collection', ['vsphere']) do
|
2
|
-
|
3
2
|
servers = Fog::Compute[:vsphere].servers
|
4
3
|
|
5
4
|
tests('The servers collection') do
|
6
|
-
test('should not be empty') {
|
7
|
-
test('should be a kind of Fog::Compute::Vsphere::Servers') { servers.
|
5
|
+
test('should not be empty') { !servers.empty? }
|
6
|
+
test('should be a kind of Fog::Compute::Vsphere::Servers') { servers.is_a? Fog::Compute::Vsphere::Servers }
|
8
7
|
tests('should be able to reload itself').succeeds { servers.reload }
|
9
8
|
tests('should be able to get a model') do
|
10
9
|
tests('by managed object reference').succeeds { servers.get 'jefftest' }
|
11
10
|
tests('by instance uuid').succeeds { servers.get '5032c8a5-9c5e-ba7a-3804-832a03e16381' }
|
12
11
|
end
|
13
12
|
end
|
14
|
-
|
15
13
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:vsphere] | hosts collection', ['vsphere']) do
|
2
|
+
servers = Fog::Compute[:vsphere].servers
|
3
|
+
server = servers.last
|
4
|
+
ticket = server.acquire_ticket
|
5
|
+
|
6
|
+
tests('A ticket') do
|
7
|
+
test('should have a ticket') { !ticket.ticket.empty? }
|
8
|
+
test('should have a host') { !ticket.host.empty? }
|
9
|
+
test('should have a port') { ticket.port.is_a?(Integer) }
|
10
|
+
test('should have a ssl ssl_thumbprint') { !ticket.ssl_thumbprint.empty? }
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:vsphere] | hosts collection', ['vsphere']) do
|
2
|
+
service = Fog::Compute[:vsphere]
|
3
|
+
server = service.servers.last
|
4
|
+
|
5
|
+
tests('The tickets collection') do
|
6
|
+
test('should create a ticket for a server') { service.tickets(server: server).create.is_a? Fog::Compute::Vsphere::Ticket }
|
7
|
+
end
|
8
|
+
end
|
@@ -1,12 +1,10 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | current_time request', ['vsphere']) do
|
2
|
-
|
3
2
|
compute = Fog::Compute[:vsphere]
|
4
3
|
|
5
4
|
tests('The response should') do
|
6
5
|
response = compute.current_time
|
7
|
-
test('be a kind of Hash') { response.
|
6
|
+
test('be a kind of Hash') { response.is_a? Hash }
|
8
7
|
test('have a current_time key') { response.key? 'current_time' }
|
9
|
-
test('have a current_time key with a Time value') { response['current_time'].
|
8
|
+
test('have a current_time key with a Time value') { response['current_time'].is_a? Time }
|
10
9
|
end
|
11
|
-
|
12
10
|
end
|
@@ -1,21 +1,19 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | folder_destroy request', ['vsphere']) do
|
2
|
-
|
3
2
|
compute = Fog::Compute[:vsphere]
|
4
3
|
|
5
|
-
empty_folder =
|
6
|
-
full_folder =
|
7
|
-
datacenter =
|
4
|
+
empty_folder = '/Solutions/empty'
|
5
|
+
full_folder = '/Solutions/wibble'
|
6
|
+
datacenter = 'Solutions'
|
8
7
|
|
9
8
|
tests('The response should') do
|
10
9
|
response = compute.folder_destroy(empty_folder, datacenter)
|
11
|
-
test('be a kind of Hash') { response.
|
10
|
+
test('be a kind of Hash') { response.is_a? Hash }
|
12
11
|
test('should have a task_state key') { response.key? 'task_state' }
|
13
12
|
end
|
14
|
-
|
13
|
+
|
15
14
|
tests('When folder is not empty') do
|
16
15
|
raises(Fog::Vsphere::Errors::ServiceError, 'raises ServiceError') do
|
17
16
|
compute.folder_destroy(full_folder, datacenter)
|
18
17
|
end
|
19
18
|
end
|
20
|
-
|
21
19
|
end
|
@@ -1,50 +1,46 @@
|
|
1
1
|
require 'ostruct'
|
2
2
|
|
3
3
|
Shindo.tests('Fog::Compute[:vsphere] | get_network request', ['vsphere']) do
|
4
|
-
|
5
4
|
compute = Fog::Compute[:vsphere]
|
6
5
|
|
7
|
-
|
8
6
|
class DistributedVirtualPortgroup
|
9
7
|
attr_accessor :name, :dvs_name
|
10
8
|
|
11
|
-
def initialize
|
9
|
+
def initialize(attrs)
|
12
10
|
@name = attrs.fetch(:name)
|
13
11
|
@dvs_name = attrs.fetch(:dvs_name)
|
14
12
|
end
|
15
13
|
|
16
14
|
def config
|
17
|
-
OpenStruct.new(
|
15
|
+
OpenStruct.new(distributedVirtualSwitch: OpenStruct.new(name: dvs_name))
|
18
16
|
end
|
19
17
|
end
|
20
18
|
|
21
|
-
fake_networks = [OpenStruct.new(:
|
22
|
-
DistributedVirtualPortgroup.new(
|
23
|
-
DistributedVirtualPortgroup.new(
|
24
|
-
DistributedVirtualPortgroup.new(
|
25
|
-
]
|
26
|
-
|
19
|
+
fake_networks = [OpenStruct.new(name: 'non-dvs'),
|
20
|
+
DistributedVirtualPortgroup.new(name: 'web1', dvs_name: 'dvs5'),
|
21
|
+
DistributedVirtualPortgroup.new(name: 'web1', dvs_name: 'dvs11'),
|
22
|
+
DistributedVirtualPortgroup.new(name: 'other', dvs_name: 'other')]
|
27
23
|
|
28
24
|
tests('#choose_finder should') do
|
29
|
-
test('choose the network based on network name and dvs name')
|
25
|
+
test('choose the network based on network name and dvs name') do
|
30
26
|
finder = compute.send(:choose_finder, 'web1', 'dvs11')
|
31
|
-
found_network = fake_networks.find{ |n| finder.call(n) }
|
27
|
+
found_network = fake_networks.find { |n| finder.call(n) }
|
32
28
|
found_network.name == 'web1' && found_network.dvs_name == 'dvs11'
|
33
|
-
|
34
|
-
test('choose the network based on network name and any dvs')
|
29
|
+
end
|
30
|
+
test('choose the network based on network name and any dvs') do
|
35
31
|
finder = compute.send(:choose_finder, 'web1', :dvs)
|
36
|
-
found_network = fake_networks.find{ |n| finder.call(n) }
|
32
|
+
found_network = fake_networks.find { |n| finder.call(n) }
|
37
33
|
found_network.name == 'web1' && found_network.dvs_name == 'dvs5'
|
38
|
-
|
39
|
-
test('choose the network based on network name only')
|
34
|
+
end
|
35
|
+
test('choose the network based on network name only') do
|
40
36
|
finder = compute.send(:choose_finder, 'other', nil)
|
41
|
-
found_network = fake_networks.find{ |n| finder.call(n) }
|
37
|
+
found_network = fake_networks.find { |n| finder.call(n) }
|
42
38
|
found_network.name == 'other' && found_network.dvs_name == 'other'
|
43
|
-
|
44
|
-
test('choose the network based on network name only for non-dvs')
|
39
|
+
end
|
40
|
+
test('choose the network based on network name only for non-dvs') do
|
45
41
|
finder = compute.send(:choose_finder, 'non-dvs', nil)
|
46
|
-
found_network = fake_networks.find{ |n| finder.call(n) }
|
42
|
+
found_network = fake_networks.find { |n| finder.call(n) }
|
47
43
|
found_network.name == 'non-dvs' && found_network.class.name.to_s == 'OpenStruct'
|
48
|
-
|
44
|
+
end
|
49
45
|
end
|
50
46
|
end
|
@@ -1,10 +1,9 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | list_child_snapshots request', ['vsphere']) do
|
2
|
-
|
3
2
|
compute = Fog::Compute[:vsphere]
|
4
3
|
|
5
4
|
tests('The response should') do
|
6
5
|
response = compute.list_child_snapshots('snapshot-0101')
|
7
|
-
test('be a kind of Array') { response.
|
6
|
+
test('be a kind of Array') { response.is_a? Array }
|
8
7
|
test('it should contains Hashes') { response.all? { |i| Hash === i } }
|
9
8
|
end
|
10
9
|
end
|
@@ -1,11 +1,10 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | list_clusters request', ['vsphere']) do
|
2
|
-
tests(
|
3
|
-
|
2
|
+
tests('When listing all clusters') do
|
4
3
|
response = Fog::Compute[:vsphere].list_clusters
|
5
|
-
test(
|
4
|
+
test('Clusters extracted from folders... ') { response.length == 4 }
|
6
5
|
|
7
|
-
tests(
|
8
|
-
test(
|
6
|
+
tests('The response data format ...') do
|
7
|
+
test('be a kind of Hash') { response.is_a? Array }
|
9
8
|
end
|
10
9
|
end
|
11
|
-
end
|
10
|
+
end
|
@@ -1,18 +1,17 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | list_datastores request', ['vsphere']) do
|
2
|
-
|
3
2
|
compute = Fog::Compute[:vsphere]
|
4
3
|
|
5
4
|
tests('The response with datastore filter should') do
|
6
|
-
response = compute.list_datastores(:
|
7
|
-
test('be a kind of Array') { response.
|
5
|
+
response = compute.list_datastores(datacenter: 'Solutions')
|
6
|
+
test('be a kind of Array') { response.is_a? Array }
|
8
7
|
test('contain Hashes') { response.all? { |i| Hash === i } }
|
9
|
-
test(
|
8
|
+
test('have 2 elements') { response.length == 2 }
|
10
9
|
end
|
11
10
|
|
12
11
|
tests('The response with cluster filter should') do
|
13
|
-
response = compute.list_datastores(:
|
14
|
-
test('be a kind of Array') { response.
|
12
|
+
response = compute.list_datastores(datacenter: 'Solutions', cluster: 'Solutionscluster')
|
13
|
+
test('be a kind of Array') { response.is_a? Array }
|
15
14
|
test('contain Hashes') { response.all? { |i| Hash === i } }
|
16
|
-
test(
|
15
|
+
test('have a single element') { response.length == 1 }
|
17
16
|
end
|
18
17
|
end
|
@@ -1,11 +1,10 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | list_hosts request', ['vsphere']) do
|
2
|
-
|
3
2
|
compute = Fog::Compute[:vsphere]
|
4
3
|
|
5
4
|
tests('The response should') do
|
6
|
-
response = compute.list_hosts(:
|
7
|
-
test('be a kind of Array') { response.
|
5
|
+
response = compute.list_hosts(datacenter: 'Solutions', cluster: 'Solutionscluster')
|
6
|
+
test('be a kind of Array') { response.is_a? Array }
|
8
7
|
test('contain Hashes') { response.all? { |i| Hash === i } }
|
9
|
-
test(
|
8
|
+
test('have 1 element') { response.length == 1 }
|
10
9
|
end
|
11
10
|
end
|
@@ -1,18 +1,17 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | list_networks request', ['vsphere']) do
|
2
|
-
|
3
2
|
compute = Fog::Compute[:vsphere]
|
4
3
|
|
5
4
|
tests('The response with datastore filter should') do
|
6
|
-
response = compute.list_networks(:
|
7
|
-
test('be a kind of Array') { response.
|
5
|
+
response = compute.list_networks(datacenter: 'Solutions')
|
6
|
+
test('be a kind of Array') { response.is_a? Array }
|
8
7
|
test('contain Hashes') { response.all? { |i| Hash === i } }
|
9
|
-
test(
|
8
|
+
test('have 2 elements') { response.length == 2 }
|
10
9
|
end
|
11
10
|
|
12
11
|
tests('The response with cluster filter should') do
|
13
|
-
response = compute.list_networks(:
|
14
|
-
test('be a kind of Array') { response.
|
12
|
+
response = compute.list_networks(datacenter: 'Solutions', cluster: 'Solutionscluster')
|
13
|
+
test('be a kind of Array') { response.is_a? Array }
|
15
14
|
test('contain Hashes') { response.all? { |i| Hash === i } }
|
16
|
-
test(
|
15
|
+
test('have a single element') { response.length == 1 }
|
17
16
|
end
|
18
17
|
end
|
@@ -1,10 +1,9 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | list_storage_pods request', ['vsphere']) do
|
2
|
-
tests(
|
3
|
-
|
2
|
+
tests('When listing all storage pods') do
|
4
3
|
response = Fog::Compute[:vsphere].list_storage_pods
|
5
4
|
|
6
|
-
tests(
|
7
|
-
test(
|
5
|
+
tests('The response data format ...') do
|
6
|
+
test('be a kind of Hash') { response.is_a? Array }
|
8
7
|
end
|
9
8
|
end
|
10
9
|
end
|
@@ -1,38 +1,34 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | list_virtual_machines request', ['vsphere']) do
|
2
|
-
|
3
|
-
tests("When listing all machines") do
|
4
|
-
|
2
|
+
tests('When listing all machines') do
|
5
3
|
response = Fog::Compute[:vsphere].list_virtual_machines
|
6
4
|
|
7
|
-
tests(
|
8
|
-
test(
|
5
|
+
tests('The response data format ...') do
|
6
|
+
test('be a kind of Hash') { response.is_a? Array }
|
9
7
|
end
|
10
8
|
end
|
11
9
|
|
12
|
-
tests(
|
13
|
-
|
10
|
+
tests('When providing an instance_uuid') do
|
14
11
|
# pending unless Fog.mock?
|
15
12
|
|
16
|
-
tests(
|
17
|
-
uuid =
|
18
|
-
response = Fog::Compute[:vsphere].list_virtual_machines(
|
13
|
+
tests('that does exist') do
|
14
|
+
uuid = '5029c440-85ee-c2a1-e9dd-b63e39364603'
|
15
|
+
response = Fog::Compute[:vsphere].list_virtual_machines('instance_uuid' => uuid)
|
19
16
|
|
20
|
-
tests(
|
21
|
-
test(
|
22
|
-
test(
|
23
|
-
test(
|
17
|
+
tests('The response should') do
|
18
|
+
test('contain one vm') { response.length == 1 }
|
19
|
+
test('contain that is an attribute hash') { response[0].is_a? Hash }
|
20
|
+
test('find jefftest') { response.first['name'] == 'jefftest' }
|
24
21
|
end
|
25
22
|
end
|
26
23
|
|
27
|
-
tests(
|
28
|
-
%w
|
29
|
-
response = Fog::Compute[:vsphere].list_virtual_machines(
|
24
|
+
tests('that does not exist or is a template') do
|
25
|
+
%w[does-not-exist-and-is-not-a-uuid 50323f93-6835-1178-8b8f-9e2109890e1a].each do |uuid|
|
26
|
+
response = Fog::Compute[:vsphere].list_virtual_machines('instance_uuid' => uuid)
|
30
27
|
|
31
|
-
tests(
|
32
|
-
test(
|
28
|
+
tests('The response should') do
|
29
|
+
test('be empty') { response.empty? }
|
33
30
|
end
|
34
31
|
end
|
35
32
|
end
|
36
33
|
end
|
37
|
-
|
38
34
|
end
|