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