fog-vsphere 2.1.1 → 2.2.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 +8 -0
- data/.rubocop_todo.yml +217 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +4 -0
- data/Rakefile +10 -1
- data/fog-vsphere.gemspec +2 -2
- data/lib/fog/bin/vsphere.rb +1 -1
- data/lib/fog/vsphere/compute.rb +320 -301
- data/lib/fog/vsphere/models/compute/cdrom.rb +10 -10
- data/lib/fog/vsphere/models/compute/cdroms.rb +2 -2
- data/lib/fog/vsphere/models/compute/cluster.rb +20 -20
- data/lib/fog/vsphere/models/compute/clusters.rb +1 -1
- data/lib/fog/vsphere/models/compute/customfields.rb +4 -4
- data/lib/fog/vsphere/models/compute/customvalues.rb +8 -8
- data/lib/fog/vsphere/models/compute/datacenter.rb +16 -16
- data/lib/fog/vsphere/models/compute/datastores.rb +1 -1
- data/lib/fog/vsphere/models/compute/folder.rb +2 -2
- data/lib/fog/vsphere/models/compute/folders.rb +2 -2
- data/lib/fog/vsphere/models/compute/hosts.rb +4 -4
- data/lib/fog/vsphere/models/compute/interface.rb +12 -12
- data/lib/fog/vsphere/models/compute/interfaces.rb +14 -16
- data/lib/fog/vsphere/models/compute/interfacetype.rb +2 -2
- data/lib/fog/vsphere/models/compute/interfacetypes.rb +6 -8
- data/lib/fog/vsphere/models/compute/networks.rb +1 -1
- data/lib/fog/vsphere/models/compute/resource_pools.rb +1 -1
- data/lib/fog/vsphere/models/compute/rule.rb +8 -9
- data/lib/fog/vsphere/models/compute/rules.rb +9 -10
- data/lib/fog/vsphere/models/compute/scsicontroller.rb +1 -1
- data/lib/fog/vsphere/models/compute/server.rb +68 -80
- data/lib/fog/vsphere/models/compute/servers.rb +12 -13
- data/lib/fog/vsphere/models/compute/servertype.rb +6 -6
- data/lib/fog/vsphere/models/compute/servertypes.rb +2 -2
- data/lib/fog/vsphere/models/compute/snapshot.rb +5 -6
- data/lib/fog/vsphere/models/compute/snapshots.rb +1 -1
- data/lib/fog/vsphere/models/compute/ticket.rb +0 -1
- data/lib/fog/vsphere/models/compute/volume.rb +12 -14
- data/lib/fog/vsphere/models/compute/volumes.rb +10 -10
- data/lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb +8 -8
- data/lib/fog/vsphere/requests/compute/create_folder.rb +5 -5
- data/lib/fog/vsphere/requests/compute/create_group.rb +16 -16
- data/lib/fog/vsphere/requests/compute/create_rule.rb +13 -13
- data/lib/fog/vsphere/requests/compute/create_vm.rb +117 -119
- data/lib/fog/vsphere/requests/compute/destroy_group.rb +8 -8
- data/lib/fog/vsphere/requests/compute/destroy_rule.rb +8 -8
- data/lib/fog/vsphere/requests/compute/folder_destroy.rb +3 -3
- data/lib/fog/vsphere/requests/compute/get_cluster.rb +2 -2
- data/lib/fog/vsphere/requests/compute/get_compute_resource.rb +16 -16
- data/lib/fog/vsphere/requests/compute/get_datacenter.rb +7 -7
- data/lib/fog/vsphere/requests/compute/get_datastore.rb +1 -2
- data/lib/fog/vsphere/requests/compute/get_folder.rb +24 -24
- data/lib/fog/vsphere/requests/compute/get_host.rb +2 -3
- data/lib/fog/vsphere/requests/compute/get_interface_type.rb +6 -6
- data/lib/fog/vsphere/requests/compute/get_network.rb +7 -10
- data/lib/fog/vsphere/requests/compute/get_resource_pool.rb +1 -2
- data/lib/fog/vsphere/requests/compute/get_server_type.rb +14 -14
- data/lib/fog/vsphere/requests/compute/get_storage_pod.rb +2 -2
- data/lib/fog/vsphere/requests/compute/get_template.rb +1 -2
- data/lib/fog/vsphere/requests/compute/get_virtual_machine.rb +26 -26
- data/lib/fog/vsphere/requests/compute/get_vm_first_scsi_controller.rb +6 -7
- data/lib/fog/vsphere/requests/compute/host_finish_maintenance.rb +1 -1
- data/lib/fog/vsphere/requests/compute/host_shutdown.rb +1 -1
- data/lib/fog/vsphere/requests/compute/host_start_maintenance.rb +1 -1
- data/lib/fog/vsphere/requests/compute/list_child_snapshots.rb +37 -39
- data/lib/fog/vsphere/requests/compute/list_clusters.rb +8 -9
- data/lib/fog/vsphere/requests/compute/list_compute_resources.rb +57 -59
- data/lib/fog/vsphere/requests/compute/list_customfields.rb +5 -6
- data/lib/fog/vsphere/requests/compute/list_datacenters.rb +17 -17
- data/lib/fog/vsphere/requests/compute/list_datastores.rb +16 -15
- data/lib/fog/vsphere/requests/compute/list_folders.rb +4 -4
- data/lib/fog/vsphere/requests/compute/list_groups.rb +5 -5
- data/lib/fog/vsphere/requests/compute/list_hosts.rb +30 -14
- data/lib/fog/vsphere/requests/compute/list_interface_types.rb +7 -7
- data/lib/fog/vsphere/requests/compute/list_networks.rb +12 -16
- data/lib/fog/vsphere/requests/compute/list_processes.rb +14 -14
- data/lib/fog/vsphere/requests/compute/list_resource_pools.rb +13 -14
- data/lib/fog/vsphere/requests/compute/list_rules.rb +4 -4
- data/lib/fog/vsphere/requests/compute/list_server_types.rb +24 -26
- data/lib/fog/vsphere/requests/compute/list_storage_pods.rb +8 -8
- data/lib/fog/vsphere/requests/compute/list_templates.rb +4 -5
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +15 -15
- data/lib/fog/vsphere/requests/compute/list_vm_cdroms.rb +16 -12
- data/lib/fog/vsphere/requests/compute/list_vm_customvalues.rb +3 -4
- data/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb +54 -56
- data/lib/fog/vsphere/requests/compute/list_vm_scsi_controllers.rb +7 -7
- data/lib/fog/vsphere/requests/compute/list_vm_snapshots.rb +36 -36
- data/lib/fog/vsphere/requests/compute/list_vm_volumes.rb +43 -36
- data/lib/fog/vsphere/requests/compute/modify_vm_cdrom.rb +4 -4
- data/lib/fog/vsphere/requests/compute/modify_vm_controller.rb +2 -2
- data/lib/fog/vsphere/requests/compute/modify_vm_interface.rb +26 -19
- data/lib/fog/vsphere/requests/compute/modify_vm_volume.rb +7 -7
- data/lib/fog/vsphere/requests/compute/revert_to_snapshot.rb +2 -2
- data/lib/fog/vsphere/requests/compute/set_vm_customvalue.rb +2 -2
- data/lib/fog/vsphere/requests/compute/update_vm.rb +111 -0
- data/lib/fog/vsphere/requests/compute/upload_iso.rb +10 -10
- data/lib/fog/vsphere/requests/compute/vm_acquire_ticket.rb +3 -3
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +245 -247
- data/lib/fog/vsphere/requests/compute/vm_config_vnc.rb +15 -15
- data/lib/fog/vsphere/requests/compute/vm_destroy.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_execute.rb +16 -16
- data/lib/fog/vsphere/requests/compute/vm_migrate.rb +11 -11
- data/lib/fog/vsphere/requests/compute/vm_power_off.rb +8 -8
- data/lib/fog/vsphere/requests/compute/vm_power_on.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_reboot.rb +5 -5
- data/lib/fog/vsphere/requests/compute/vm_reconfig_cdrom.rb +11 -11
- data/lib/fog/vsphere/requests/compute/vm_reconfig_cpus.rb +8 -8
- data/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb +6 -6
- data/lib/fog/vsphere/requests/compute/vm_reconfig_memory.rb +8 -8
- data/lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb +14 -16
- data/lib/fog/vsphere/requests/compute/vm_relocate.rb +8 -8
- data/lib/fog/vsphere/requests/compute/vm_remove_snapshot.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_rename.rb +5 -5
- data/lib/fog/vsphere/requests/compute/vm_revert_snapshot.rb +1 -1
- data/lib/fog/vsphere/requests/compute/vm_take_snapshot.rb +8 -8
- data/lib/fog/vsphere/version.rb +1 -1
- 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 +30 -31
- data/tests/models/compute/servers_tests.rb +2 -4
- data/tests/models/compute/ticket_tests.rb +4 -6
- data/tests/models/compute/tickets_tests.rb +1 -3
- 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 +20 -23
- 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/update_vm_tests.rb +13 -0
- 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_take_snapshot_tests.rb +1 -3
- metadata +9 -4
@@ -1,10 +1,8 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | hosts collection', ['vsphere']) do
|
2
|
-
|
3
2
|
service = Fog::Compute[:vsphere]
|
4
3
|
server = service.servers.last
|
5
4
|
|
6
5
|
tests('The tickets collection') do
|
7
|
-
test('should create a ticket for a server') { service.tickets(:
|
6
|
+
test('should create a ticket for a server') { service.tickets(server: server).create.is_a? Fog::Compute::Vsphere::Ticket }
|
8
7
|
end
|
9
|
-
|
10
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,47 @@
|
|
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
|
-
attr_accessor :name, :dvs_name
|
7
|
+
attr_accessor :name, :dvs_name, :key
|
10
8
|
|
11
|
-
def initialize
|
9
|
+
def initialize(attrs)
|
12
10
|
@name = attrs.fetch(:name)
|
13
11
|
@dvs_name = attrs.fetch(:dvs_name)
|
12
|
+
@key = attrs.fetch(:key)
|
14
13
|
end
|
15
14
|
|
16
15
|
def config
|
17
|
-
OpenStruct.new(
|
16
|
+
OpenStruct.new(distributedVirtualSwitch: OpenStruct.new(name: dvs_name))
|
18
17
|
end
|
19
18
|
end
|
20
19
|
|
21
|
-
fake_networks = [OpenStruct.new(:
|
22
|
-
DistributedVirtualPortgroup.new(
|
23
|
-
DistributedVirtualPortgroup.new(
|
24
|
-
DistributedVirtualPortgroup.new(
|
25
|
-
]
|
26
|
-
|
20
|
+
fake_networks = [OpenStruct.new(name: 'non-dvs'),
|
21
|
+
DistributedVirtualPortgroup.new(name: 'web1', dvs_name: 'dvs5', key: '4001'),
|
22
|
+
DistributedVirtualPortgroup.new(name: 'web1', dvs_name: 'dvs11', key: '4001'),
|
23
|
+
DistributedVirtualPortgroup.new(name: 'other', dvs_name: 'other', key: '4001')]
|
27
24
|
|
28
25
|
tests('#choose_finder should') do
|
29
|
-
test('choose the network based on network name and dvs name')
|
26
|
+
test('choose the network based on network name and dvs name') do
|
30
27
|
finder = compute.send(:choose_finder, 'web1', 'dvs11')
|
31
|
-
found_network = fake_networks.find{ |n| finder.call(n) }
|
28
|
+
found_network = fake_networks.find { |n| finder.call(n) }
|
32
29
|
found_network.name == 'web1' && found_network.dvs_name == 'dvs11'
|
33
|
-
|
34
|
-
test('choose the network based on network name and any dvs')
|
30
|
+
end
|
31
|
+
test('choose the network based on network name and any dvs') do
|
35
32
|
finder = compute.send(:choose_finder, 'web1', :dvs)
|
36
|
-
found_network = fake_networks.find{ |n| finder.call(n) }
|
33
|
+
found_network = fake_networks.find { |n| finder.call(n) }
|
37
34
|
found_network.name == 'web1' && found_network.dvs_name == 'dvs5'
|
38
|
-
|
39
|
-
test('choose the network based on network name only')
|
35
|
+
end
|
36
|
+
test('choose the network based on network name only') do
|
40
37
|
finder = compute.send(:choose_finder, 'other', nil)
|
41
|
-
found_network = fake_networks.find{ |n| finder.call(n) }
|
38
|
+
found_network = fake_networks.find { |n| finder.call(n) }
|
42
39
|
found_network.name == 'other' && found_network.dvs_name == 'other'
|
43
|
-
|
44
|
-
test('choose the network based on network name only for non-dvs')
|
40
|
+
end
|
41
|
+
test('choose the network based on network name only for non-dvs') do
|
45
42
|
finder = compute.send(:choose_finder, 'non-dvs', nil)
|
46
|
-
found_network = fake_networks.find{ |n| finder.call(n) }
|
43
|
+
found_network = fake_networks.find { |n| finder.call(n) }
|
47
44
|
found_network.name == 'non-dvs' && found_network.class.name.to_s == 'OpenStruct'
|
48
|
-
|
45
|
+
end
|
49
46
|
end
|
50
47
|
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
|
@@ -1,10 +1,9 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | list_vm_cdroms request', ['vsphere']) do
|
2
|
-
|
3
2
|
compute = Fog::Compute[:vsphere]
|
4
3
|
|
5
4
|
tests('The response should') do
|
6
5
|
response = compute.list_vm_cdroms('5032c8a5-9c5e-ba7a-3804-832a03e16381')
|
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,10 +1,9 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | list_vm_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_vm_snapshots('5032c8a5-9c5e-ba7a-3804-832a03e16381')
|
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,21 +1,20 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | modify_vm_cdrom request', ['vsphere']) do
|
2
|
-
|
3
2
|
compute = Fog::Compute[:vsphere]
|
4
3
|
|
5
4
|
modify_target = '5032c8a5-9c5e-ba7a-3804-832a03e16381'
|
6
5
|
modify_cdrom = compute.cdroms.new(
|
7
|
-
instance_uuid: modify_target
|
6
|
+
instance_uuid: modify_target
|
8
7
|
)
|
9
8
|
|
10
9
|
tests('When adding a cdrom the response should') do
|
11
10
|
response = compute.add_vm_cdrom(modify_cdrom)
|
12
|
-
test('be a kind of Hash') { response.
|
11
|
+
test('be a kind of Hash') { response.is_a? Hash }
|
13
12
|
test('should have a task_state key') { response.key? 'task_state' }
|
14
13
|
end
|
15
14
|
|
16
15
|
tests('When destroying a cdrom the response should') do
|
17
16
|
response = compute.destroy_vm_cdrom(modify_cdrom)
|
18
|
-
test('be a kind of Hash') { response.
|
17
|
+
test('be a kind of Hash') { response.is_a? Hash }
|
19
18
|
test('should have a task_state key') { response.key? 'task_state' }
|
20
19
|
end
|
21
20
|
end
|
@@ -1,15 +1,13 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | revert_to_snapshot request', ['vsphere']) do
|
2
|
-
|
3
2
|
compute = Fog::Compute[:vsphere]
|
4
3
|
|
5
4
|
tests('The response should') do
|
6
|
-
response = compute.revert_to_snapshot(Fog::Compute::Vsphere::Snapshot.new(:
|
7
|
-
test('be a kind of Hash') { response.
|
5
|
+
response = compute.revert_to_snapshot(Fog::Compute::Vsphere::Snapshot.new(service: 1))
|
6
|
+
test('be a kind of Hash') { response.is_a? Hash }
|
8
7
|
test('should have a task_state key') { response.key? 'state' }
|
9
8
|
end
|
10
9
|
|
11
10
|
tests('The expected options') do
|
12
11
|
raises(ArgumentError, 'raises ArgumentError when input param is missing') { compute.revert_to_snapshot(nil) }
|
13
12
|
end
|
14
|
-
|
15
13
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:vsphere] | set_vm_customvalue request', ['vsphere']) do
|
2
|
-
|
3
2
|
compute = Fog::Compute[:vsphere]
|
4
3
|
|
5
4
|
instance_uuid = '50137835-88a1-436e-768e-9b2677076e67'
|
@@ -16,5 +15,4 @@ Shindo.tests('Fog::Compute[:vsphere] | set_vm_customvalue request', ['vsphere'])
|
|
16
15
|
raises(ArgumentError, 'raises ArgumentError when custom_key option is missing') { compute.set_vm_customvalue(instance_uuid) }
|
17
16
|
raises(ArgumentError, 'raises ArgumentError when custom_value option is missing') { compute.set_vm_customvalue(instance_uuid, custom_key) }
|
18
17
|
end
|
19
|
-
|
20
18
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
Shindo.tests('Fog::Compute[:vsphere] | update_vm request', 'vsphere') do
|
4
|
+
compute = Fog::Compute[:vsphere]
|
5
|
+
server = Fog::Compute::Vsphere::Server.new
|
6
|
+
|
7
|
+
tests('UPDATE vm | The return value should') do
|
8
|
+
response = compute.update_vm(server)
|
9
|
+
test('be a kind of Hash') { response.is_a? Hash }
|
10
|
+
test('should have a task_state key') { response.key? 'task_state' }
|
11
|
+
test('be a kind of Hash') { response.is_a? Hash }
|
12
|
+
end
|
13
|
+
end
|
@@ -1,47 +1,47 @@
|
|
1
|
-
Shindo.tests(
|
1
|
+
Shindo.tests('Fog::Compute[:vsphere] | vm_clone request', 'vsphere') do
|
2
2
|
# require 'guid'
|
3
3
|
compute = Fog::Compute[:vsphere]
|
4
4
|
response = nil
|
5
5
|
response_linked = nil
|
6
6
|
|
7
|
-
template =
|
8
|
-
datacenter =
|
7
|
+
template = 'rhel64'
|
8
|
+
datacenter = 'Solutions'
|
9
9
|
|
10
|
-
tests(
|
10
|
+
tests('Standard Clone | The return value should') do
|
11
11
|
servers_size = compute.servers.size
|
12
12
|
response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm', 'wait' => true)
|
13
|
-
test(
|
14
|
-
%w
|
13
|
+
test('be a kind of Hash') { response.is_a? Hash }
|
14
|
+
%w[vm_ref new_vm task_ref].each do |key|
|
15
15
|
test("have a #{key} key") { response.key? key }
|
16
16
|
end
|
17
|
-
test(
|
18
|
-
test(
|
17
|
+
test('creates a new server') { compute.servers.size == servers_size + 1 }
|
18
|
+
test('new server name is set') { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm' }
|
19
19
|
end
|
20
20
|
|
21
|
-
tests(
|
21
|
+
tests('Standard Clone setting ram and cpu | The return value should') do
|
22
22
|
servers_size = compute.servers.size
|
23
23
|
response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm', 'memoryMB' => '8192', 'numCPUs' => '8', 'wait' => true)
|
24
|
-
test(
|
25
|
-
%w
|
24
|
+
test('be a kind of Hash') { response.is_a? Hash }
|
25
|
+
%w[vm_ref new_vm task_ref].each do |key|
|
26
26
|
test("have a #{key} key") { response.key? key }
|
27
27
|
end
|
28
|
-
test(
|
29
|
-
test(
|
28
|
+
test('creates a new server') { compute.servers.size == servers_size + 1 }
|
29
|
+
test('new server name is set') { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm' }
|
30
30
|
end
|
31
31
|
|
32
|
-
tests(
|
32
|
+
tests('Linked Clone | The return value should') do
|
33
33
|
servers_size = compute.servers.size
|
34
34
|
response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm_linked', 'wait' => 1, 'linked_clone' => true)
|
35
|
-
test(
|
36
|
-
%w
|
35
|
+
test('be a kind of Hash') { response.is_a? Hash }
|
36
|
+
%w[vm_ref new_vm task_ref].each do |key|
|
37
37
|
test("have a #{key} key") { response.key? key }
|
38
38
|
end
|
39
|
-
test(
|
40
|
-
test(
|
39
|
+
test('creates a new server') { compute.servers.size == servers_size + 1 }
|
40
|
+
test('new server name is set') { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm_linked' }
|
41
41
|
end
|
42
42
|
|
43
|
-
tests(
|
44
|
-
raises(ArgumentError, 'it should raise ArgumentError') { compute.vm_clone(:
|
43
|
+
tests('When invalid input is presented') do
|
44
|
+
raises(ArgumentError, 'it should raise ArgumentError') { compute.vm_clone(foo: 1) }
|
45
45
|
raises(Fog::Compute::Vsphere::NotFound, 'it should raise Fog::Compute::Vsphere::NotFound when the UUID is not a string') do
|
46
46
|
pending # require 'guid'
|
47
47
|
compute.vm_clone('instance_uuid' => Guid.from_s(template), 'name' => 'jefftestfoo')
|