fog-arubacloud 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +0 -0
- data/.gitignore +0 -0
- data/.rubocop.yml +0 -0
- data/.ruby-version +0 -0
- data/.travis.yml +0 -0
- data/CONTRIBUTING.md +0 -0
- data/CONTRIBUTORS.md +0 -0
- data/Gemfile +0 -0
- data/LICENSE.md +0 -0
- data/README.md +3 -3
- data/Rakefile +99 -5
- data/{lib/fog/arubacloud/examples → examples}/create_pro_server.rb +3 -3
- data/{lib/fog/arubacloud/examples → examples}/create_smart_server.rb +0 -0
- data/{lib/fog/arubacloud/examples → examples}/get_objects.rb +1 -1
- data/{lib/fog/arubacloud/examples → examples}/get_servers.rb +0 -0
- data/{lib/fog/arubacloud/examples → examples}/vm_operations.rb +1 -1
- data/fog-arubacloud.gemspec +12 -12
- data/gemfiles/fog-arubacloud-0.0.4.gem +0 -0
- data/lib/fog/arubacloud/compute/models/custom_template.rb +60 -0
- data/lib/fog/arubacloud/compute/models/custom_templates.rb +19 -0
- data/lib/fog/arubacloud/{models/compute → compute/models}/disk.rb +6 -5
- data/lib/fog/arubacloud/{models/compute → compute/models}/disks.rb +7 -7
- data/lib/fog/arubacloud/{models/compute → compute/models}/ip.rb +6 -5
- data/lib/fog/arubacloud/{models/compute → compute/models}/ips.rb +6 -6
- data/lib/fog/arubacloud/compute/models/loadbalancer.rb +135 -0
- data/lib/fog/arubacloud/compute/models/loadbalancers.rb +21 -0
- data/lib/fog/arubacloud/{models/compute → compute/models}/network_adapter.rb +2 -2
- data/lib/fog/arubacloud/{models/compute → compute/models}/network_adapters.rb +4 -4
- data/lib/fog/arubacloud/compute/models/schedule.rb +90 -0
- data/lib/fog/arubacloud/compute/models/schedules.rb +19 -0
- data/lib/fog/arubacloud/{models/compute → compute/models}/server.rb +74 -35
- data/lib/fog/arubacloud/{models/compute → compute/models}/servers.rb +10 -9
- data/lib/fog/arubacloud/compute/models/sharedstorage.rb +58 -0
- data/lib/fog/arubacloud/compute/models/sharedstorages.rb +19 -0
- data/lib/fog/arubacloud/compute/models/snapshot.rb +58 -0
- data/lib/fog/arubacloud/compute/models/snapshots.rb +19 -0
- data/lib/fog/arubacloud/{models/compute → compute/models}/template.rb +2 -2
- data/lib/fog/arubacloud/{models/compute → compute/models}/templates.rb +10 -10
- data/lib/fog/arubacloud/compute/requests/add_contact.rb +59 -0
- data/lib/fog/arubacloud/compute/requests/add_instance.rb +56 -0
- data/lib/fog/arubacloud/compute/requests/add_lb_rule.rb +58 -0
- data/lib/fog/arubacloud/compute/requests/apply_snapshot.rb +53 -0
- data/lib/fog/arubacloud/compute/requests/archive_vm.rb +59 -0
- data/lib/fog/arubacloud/compute/requests/create_loadbalancer.rb +76 -0
- data/lib/fog/arubacloud/compute/requests/create_scheduled_occurrence.rb +71 -0
- data/lib/fog/arubacloud/compute/requests/create_scheduled_operation.rb +56 -0
- data/lib/fog/arubacloud/compute/requests/create_shared_storage.rb +55 -0
- data/lib/fog/arubacloud/compute/requests/create_snapshot.rb +54 -0
- data/lib/fog/arubacloud/{requests/compute → compute/requests}/create_vm_pro.rb +9 -14
- data/lib/fog/arubacloud/{requests/compute → compute/requests}/create_vm_smart.rb +11 -15
- data/lib/fog/arubacloud/compute/requests/delete_custom_template.rb +43 -0
- data/lib/fog/arubacloud/compute/requests/delete_scheduled_operation.rb +43 -0
- data/lib/fog/arubacloud/compute/requests/delete_shared_storage.rb +49 -0
- data/lib/fog/arubacloud/compute/requests/delete_snapshot.rb +60 -0
- data/lib/fog/arubacloud/{requests/compute → compute/requests}/delete_vm.rb +13 -13
- data/lib/fog/arubacloud/compute/requests/disable_loadbalancer.rb +47 -0
- data/lib/fog/arubacloud/compute/requests/edit_shared_storage.rb +50 -0
- data/lib/fog/arubacloud/compute/requests/enable_loadbalancer.rb +47 -0
- data/lib/fog/arubacloud/compute/requests/get_custom_templates.rb +43 -0
- data/lib/fog/arubacloud/{requests/compute → compute/requests}/get_hypervisors.rb +8 -11
- data/lib/fog/arubacloud/compute/requests/get_lb_loads.rb +49 -0
- data/lib/fog/arubacloud/compute/requests/get_lb_stats.rb +49 -0
- data/lib/fog/arubacloud/compute/requests/get_loadbalancer.rb +47 -0
- data/lib/fog/arubacloud/compute/requests/get_notifications.rb +50 -0
- data/lib/fog/arubacloud/compute/requests/get_package_id.rb +60 -0
- data/lib/fog/arubacloud/{requests/compute → compute/requests}/get_purchased_ip_addresses.rb +7 -11
- data/lib/fog/arubacloud/compute/requests/get_scheduled_operations.rb +42 -0
- data/lib/fog/arubacloud/{requests/compute → compute/requests}/get_server_details.rb +7 -13
- data/lib/fog/arubacloud/{requests/compute → compute/requests}/get_servers.rb +11 -14
- data/lib/fog/arubacloud/compute/requests/get_shared_storage.rb +43 -0
- data/lib/fog/arubacloud/compute/requests/manage_custom_template.rb +72 -0
- data/lib/fog/arubacloud/compute/requests/modify_loadbalancer.rb +49 -0
- data/lib/fog/arubacloud/{requests/compute → compute/requests}/power_off_vm.rb +8 -11
- data/lib/fog/arubacloud/{requests/compute → compute/requests}/power_on_vm.rb +8 -11
- data/lib/fog/arubacloud/{requests/compute → compute/requests}/purchase_ip.rb +7 -11
- data/lib/fog/arubacloud/{requests/compute → compute/requests}/reinitialize_vm.rb +8 -14
- data/lib/fog/arubacloud/compute/requests/remove_contact.rb +48 -0
- data/lib/fog/arubacloud/compute/requests/remove_instance.rb +56 -0
- data/lib/fog/arubacloud/{requests/compute → compute/requests}/remove_ip.rb +7 -11
- data/lib/fog/arubacloud/compute/requests/remove_loadbalancer.rb +47 -0
- data/lib/fog/arubacloud/compute/requests/rename_shared_storage.rb +50 -0
- data/lib/fog/arubacloud/compute/requests/restore_vm.rb +61 -0
- data/lib/fog/arubacloud/compute/requests/suspend_scheduled_operations.rb +43 -0
- data/lib/fog/arubacloud/compute.rb +106 -22
- data/lib/fog/arubacloud/error.rb +4 -0
- data/lib/fog/arubacloud/service.rb +4 -2
- data/lib/fog/arubacloud/version.rb +3 -2
- data/lib/fog/arubacloud.rb +4 -12
- data/spec/fog/arubacloud/config_spec.rb +0 -0
- data/spec/fog/compute/arubacloud/models/disk_spec.rb +63 -0
- data/spec/fog/compute/arubacloud/models/disks_spec.rb +11 -0
- data/spec/fog/compute/arubacloud/models/ip_spec.rb +53 -0
- data/spec/fog/compute/arubacloud/models/ips_spec.rb +11 -0
- data/spec/fog/compute/arubacloud/models/loadbalancer_spec.rb +100 -0
- data/spec/fog/compute/arubacloud/models/loadbalancers_spec.rb +15 -0
- data/spec/fog/compute/arubacloud/models/network_adapter_spec.rb +33 -0
- data/spec/fog/compute/arubacloud/models/network_adapters_spec.rb +11 -0
- data/spec/fog/compute/arubacloud/models/schedule_spec.rb +102 -0
- data/spec/fog/compute/arubacloud/models/schedules_spec.rb +11 -0
- data/spec/fog/compute/arubacloud/models/server_spec.rb +155 -0
- data/spec/fog/compute/arubacloud/models/servers_spec.rb +15 -0
- data/spec/fog/compute/arubacloud/models/sharedstorage_spec.rb +86 -0
- data/spec/fog/compute/arubacloud/models/sharedstorages_spec.rb +10 -0
- data/spec/fog/compute/arubacloud/models/snapshot_spec.rb +17 -0
- data/spec/fog/compute/arubacloud/models/snapshots_spec.rb +11 -0
- data/spec/fog/compute/arubacloud/models/template_spec.rb +39 -0
- data/spec/fog/compute/arubacloud/models/templates_spec.rb +21 -0
- data/spec/fog/compute/arubacloud_spec.rb +21 -4
- data/spec/model_setup.rb +3 -1
- data/spec/spec_helper.rb +1 -1
- metadata +121 -48
- data/gemfiles/fog-arubacloud-0.0.1.gem +0 -0
- data/gemfiles/fog-arubacloud-0.0.2.gem +0 -0
- data/spec/fog/compute/arubacloud/server_spec.rb +0 -26
- data/spec/fog/compute/arubacloud/servers_spec.rb +0 -11
- data/tests/test_helper.rb +0 -8
@@ -0,0 +1,100 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/loadbalancer'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::LoadBalancer do
|
5
|
+
include ModelSetup
|
6
|
+
|
7
|
+
let (:loadbalancer_class) do
|
8
|
+
class Fog::ArubaCloud::Compute::LoadBalancer
|
9
|
+
def self.read_identity
|
10
|
+
instance_variable_get('@identity')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
Fog::ArubaCloud::Compute::LoadBalancer
|
14
|
+
end
|
15
|
+
|
16
|
+
#let(:service) { Object.new }
|
17
|
+
let(:loadbalancer) { Fog::ArubaCloud::Compute::LoadBalancer.new }
|
18
|
+
|
19
|
+
it 'must respond to #create_loadbalancer' do
|
20
|
+
loadbalancer.must_respond_to :create_loadbalancer
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'must respond to #remove_loadbalancer' do
|
24
|
+
loadbalancer.must_respond_to :remove_loadbalancer
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'must respond to #get_loadbalancer' do
|
28
|
+
loadbalancer.must_respond_to :get_loadbalancer
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'must respond to #modify_loadbalancer' do
|
32
|
+
loadbalancer.must_respond_to :modify_loadbalancer
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'must respond to #get_lb_stats' do
|
36
|
+
loadbalancer.must_respond_to :get_lb_stats
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'must respond to #get_lb_loads' do
|
40
|
+
loadbalancer.must_respond_to :get_lb_loads
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'must respond to #add_lb_rule' do
|
44
|
+
loadbalancer.must_respond_to :add_lb_rule
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'must respond to #remove_instance' do
|
48
|
+
loadbalancer.must_respond_to :remove_instance
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'must respond to #add_instance' do
|
52
|
+
loadbalancer.must_respond_to :add_instance
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'must respond to #get_notifications' do
|
56
|
+
loadbalancer.must_respond_to :get_notifications
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'must respond to #add_contact' do
|
60
|
+
loadbalancer.must_respond_to :add_contact
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'must respond to #remove_contact' do
|
64
|
+
loadbalancer.must_respond_to :remove_contact
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'must respond to #enable_loadbalancer' do
|
68
|
+
loadbalancer.must_respond_to :enable_loadbalancer
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should have 20 attributes' do
|
72
|
+
loadbalancer_class.attributes.must_equal([
|
73
|
+
:id,
|
74
|
+
:name,
|
75
|
+
:starttime,
|
76
|
+
:endtime,
|
77
|
+
:ipaddress,
|
78
|
+
:notificationcontacts,
|
79
|
+
:contactvalue,
|
80
|
+
:loadbalancercontactid,
|
81
|
+
:type,
|
82
|
+
:contactid,
|
83
|
+
:ipaddressesresourceid,
|
84
|
+
:healthchecknotification,
|
85
|
+
:newrule,
|
86
|
+
:ruleid,
|
87
|
+
:balancetype,
|
88
|
+
:certificate,
|
89
|
+
:creationdate,
|
90
|
+
:instanceport,
|
91
|
+
:loadbalancerport,
|
92
|
+
:protocol
|
93
|
+
])
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should have an unique id' do
|
97
|
+
loadbalancer_class.read_identity.must_equal(:id)
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/loadbalancers'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::LoadBalancers do
|
5
|
+
# lazy loader (same as let(:subject) { Fog::ArubaCloud::Compute::LoadBalancers })
|
6
|
+
subject { Fog::ArubaCloud::Compute::LoadBalancers }
|
7
|
+
|
8
|
+
it 'should be a collection of LoadBalancers' do
|
9
|
+
subject.model.must_equal(Fog::ArubaCloud::Compute::LoadBalancer)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'respond to #disks' do
|
13
|
+
subject.model.respond_to? :disks
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/network_adapter'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::NetworkAdapter do
|
5
|
+
include ModelSetup
|
6
|
+
|
7
|
+
let (:network_adapter_class) do
|
8
|
+
class Fog::ArubaCloud::Compute::NetworkAdapter
|
9
|
+
def self.read_identity
|
10
|
+
instance_variable_get('@identity')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
Fog::ArubaCloud::Compute::NetworkAdapter
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should have an unique id' do
|
17
|
+
network_adapter_class.read_identity.must_equal(:id)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should have 6 attributes' do
|
21
|
+
network_adapter_class.attributes.must_equal([
|
22
|
+
:id,
|
23
|
+
:mac_address,
|
24
|
+
:adapter_type,
|
25
|
+
:server_id,
|
26
|
+
:vlan,
|
27
|
+
])
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should have 1 many' do
|
31
|
+
network_adapter_class.associations.must_equal({:ip_addresses => :ips})
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/network_adapters'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::NetworkAdapters do
|
5
|
+
# lazy loader (same as let(:subject) { Fog::ArubaCloud::Compute::NetworkAdapters })
|
6
|
+
subject { Fog::ArubaCloud::Compute::NetworkAdapters }
|
7
|
+
|
8
|
+
it 'should be a collection of NetworkAdapter' do
|
9
|
+
subject.model.must_equal(Fog::ArubaCloud::Compute::NetworkAdapter)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/schedule'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::Schedule do
|
5
|
+
include ModelSetup
|
6
|
+
|
7
|
+
let (:schedule_class) do
|
8
|
+
class Fog::ArubaCloud::Compute::Schedule
|
9
|
+
def self.read_identity
|
10
|
+
instance_variable_get('@identity')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
Fog::ArubaCloud::Compute::Schedule
|
14
|
+
end
|
15
|
+
|
16
|
+
#let(:service) { Object.new }
|
17
|
+
let(:schedule) { Fog::ArubaCloud::Compute::Schedule.new }
|
18
|
+
|
19
|
+
before :each do
|
20
|
+
Fog.unmock!
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should have an unique id' do
|
24
|
+
schedule_class.read_identity.must_equal(:id)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should have 15 attributes' do
|
28
|
+
schedule_class.attributes.must_equal([
|
29
|
+
:id,
|
30
|
+
:name,
|
31
|
+
:OperationId,
|
32
|
+
:ServerId,
|
33
|
+
:OperationType,
|
34
|
+
:OperationLabel,
|
35
|
+
:dateStart,
|
36
|
+
:dateEnd,
|
37
|
+
:frequencyType,
|
38
|
+
:ScheduleDaysOfMonth,
|
39
|
+
:monthlyRecurrence,
|
40
|
+
:ScheduleWeekDays,
|
41
|
+
:daysOfMonth,
|
42
|
+
:daysOfWeek,
|
43
|
+
:frequency
|
44
|
+
])
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should respond to #get_scheduled_operations' do
|
48
|
+
schedule.respond_to? :get_scheduled_operations
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should respond to #create_scheduled_operation' do
|
52
|
+
schedule.respond_to? :create_scheduled_operation
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should respond to #create_scheduled_occurrence' do
|
56
|
+
schedule.respond_to? :create_scheduled_occurrence
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should respond to #suspend_scheduled_operation' do
|
60
|
+
schedule.respond_to? :suspend_scheduled_operation
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#get_scheduled_operations' do
|
64
|
+
describe 'without correct parameters' do
|
65
|
+
before :each do
|
66
|
+
schedule.dateStart = nil
|
67
|
+
schedule.dateEnd = nil
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should raise ArgumentError' do
|
71
|
+
schedule.stub(:service, service) do
|
72
|
+
proc {schedule.get_scheduled_operations}.must_raise ArgumentError
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
=begin
|
79
|
+
describe '#create_scheduled_operation' do
|
80
|
+
before :each do
|
81
|
+
schedule.ServerId = 12342
|
82
|
+
schedule.OperationType = 1
|
83
|
+
schedule.OperationLabel = nil
|
84
|
+
schedule.dateStart = Time.new
|
85
|
+
schedule.dateEnd = Time.new
|
86
|
+
schedule.name = 'lbtest'
|
87
|
+
end
|
88
|
+
describe 'without ServerId' do
|
89
|
+
before :each do
|
90
|
+
schedule.ServerId = nil
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'should raise ArgumentError' do
|
94
|
+
Fog.mock!
|
95
|
+
schedule.stub(:service, service) do
|
96
|
+
schedule.create_scheduled_operation.must_raise ArgumentError
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
=end
|
102
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/network_adapters'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::NetworkAdapters do
|
5
|
+
# lazy loader (same as let(:subject) { Fog::ArubaCloud::Compute::NetworkAdapters })
|
6
|
+
subject { Fog::ArubaCloud::Compute::NetworkAdapters }
|
7
|
+
|
8
|
+
it 'should be a collection of NetworkAdapter' do
|
9
|
+
subject.model.must_equal(Fog::ArubaCloud::Compute::NetworkAdapter)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/server'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::Server do
|
5
|
+
include ModelSetup
|
6
|
+
# :service is already took from ModelSetup, no need to redefine it
|
7
|
+
|
8
|
+
let (:server_class) do
|
9
|
+
class Fog::ArubaCloud::Compute::Server
|
10
|
+
def self.read_identity
|
11
|
+
instance_variable_get('@identity')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
Fog::ArubaCloud::Compute::Server
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:server) { Fog::ArubaCloud::Compute::Server.new }
|
18
|
+
let(:collection) { Object.new }
|
19
|
+
let(:service) { Object.new }
|
20
|
+
|
21
|
+
|
22
|
+
it 'should have an unique id' do
|
23
|
+
server_class.read_identity.must_equal(:id)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should have 18 attributes' do
|
27
|
+
server_class.attributes.must_equal([
|
28
|
+
:id,
|
29
|
+
:name,
|
30
|
+
:state,
|
31
|
+
:memory,
|
32
|
+
:cpu,
|
33
|
+
:hypervisor,
|
34
|
+
:datacenter_id,
|
35
|
+
:hd_qty,
|
36
|
+
:hd_total_size,
|
37
|
+
:smart_ipv4,
|
38
|
+
:smart_package,
|
39
|
+
:vnc_port,
|
40
|
+
:admin_passwd,
|
41
|
+
:vm_type,
|
42
|
+
:ipv4_addr,
|
43
|
+
:package_id,
|
44
|
+
:template_id,
|
45
|
+
:template_description
|
46
|
+
])
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#ready?' do
|
50
|
+
describe 'when the machine is ready' do
|
51
|
+
before :each do
|
52
|
+
server.state = 3
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should return true' do
|
56
|
+
server.stub(:reload, true) do
|
57
|
+
server.ready?.must_equal true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe 'when the machine is not in ready state' do
|
63
|
+
before :each do
|
64
|
+
server.state = 1
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should return false' do
|
68
|
+
server.stub(:reload, true) do
|
69
|
+
server.ready?.must_equal false
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#stopped?' do
|
76
|
+
describe 'when its stopped' do
|
77
|
+
before :each do
|
78
|
+
server.state = 2
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'should return true' do
|
82
|
+
server.stub(:reload, true) do
|
83
|
+
server.stopped?.must_equal true
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe 'when its not stopped' do
|
89
|
+
before :each do
|
90
|
+
server.state = 1
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'should return false' do
|
94
|
+
server.stopped?.must_equal false
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe 'when its in creating state' do
|
99
|
+
describe 'when its in create state' do
|
100
|
+
before :each do
|
101
|
+
server.state = 1
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'should return true' do
|
105
|
+
server.stub(:reload, true) do
|
106
|
+
server.creating?.must_equal true
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe 'when its in a different state' do
|
112
|
+
before :each do
|
113
|
+
server.state = 4
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'should return false' do
|
117
|
+
server.stub(:reload, true) do
|
118
|
+
server.creating?.must_equal false
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe '#power_on' do
|
125
|
+
describe 'on a poweron vm' do
|
126
|
+
before :each do
|
127
|
+
server.identity = 154033
|
128
|
+
server.state = 3
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'should return Fog::ArubaCloud::Errors::VmStatus' do
|
132
|
+
server.stub(:service, service) do
|
133
|
+
proc {server.power_on}.must_raise(Fog::ArubaCloud::Errors::VmStatus)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe '#power_off' do
|
140
|
+
describe 'on a powered off vm' do
|
141
|
+
before :each do
|
142
|
+
server.identity = 234234
|
143
|
+
server.state = 2
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'should return Fog::ArubaCloud::Errors::VmStatus' do
|
147
|
+
server.stub(:service, service) do
|
148
|
+
proc {server.power_off}.must_raise(Fog::ArubaCloud::Errors::VmStatus)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
155
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/servers'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::Servers do
|
5
|
+
# lazy loader (same as let(:subject) { Fog::ArubaCloud::Compute::Servers })
|
6
|
+
subject { Fog::ArubaCloud::Compute::Servers }
|
7
|
+
|
8
|
+
it 'should be a collection of Servers' do
|
9
|
+
subject.model.must_equal(Fog::ArubaCloud::Compute::Server)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'respond to #disks' do
|
13
|
+
subject.model.respond_to? :disks
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/sharedstorage'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::SharedStorage do
|
5
|
+
include ModelSetup
|
6
|
+
|
7
|
+
let (:sharedstorage_class) do
|
8
|
+
class Fog::ArubaCloud::Compute::SharedStorage
|
9
|
+
def self.read_identity
|
10
|
+
instance_variable_get('@identity')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
Fog::ArubaCloud::Compute::SharedStorage
|
14
|
+
end
|
15
|
+
|
16
|
+
#let(:service) { Object.new }
|
17
|
+
let(:sharedstorage) { Fog::ArubaCloud::Compute::SharedStorage.new }
|
18
|
+
|
19
|
+
before :each do
|
20
|
+
Fog.unmock!
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should have an unique id' do
|
24
|
+
sharedstorage_class.read_identity.must_equal(:id)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should have 15 attributes' do
|
28
|
+
sharedstorage_class.attributes.must_equal([
|
29
|
+
:id,
|
30
|
+
:quantity,
|
31
|
+
:value,
|
32
|
+
:sharedstoragename,
|
33
|
+
:sharedstorageprotocoltype,
|
34
|
+
])
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should respond to #create' do
|
38
|
+
sharedstorage_class.respond_to? :create
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should respond to #edit' do
|
42
|
+
sharedstorage_class.respond_to? :edit
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should respond to #delete' do
|
46
|
+
sharedstorage_class.respond_to? :delete
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should respond to #rename' do
|
50
|
+
sharedstorage_class.respond_to? :rename
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'create' do
|
54
|
+
before :each do
|
55
|
+
sharedstorage.sharedstorageprotocoltype = 'ISCSI'
|
56
|
+
sharedstorage.quantity = 1
|
57
|
+
sharedstorage.sharedstoragename = 'spectestsharedstorage'
|
58
|
+
end
|
59
|
+
|
60
|
+
describe 'with correct parameters' do
|
61
|
+
it 'should raise any error' do
|
62
|
+
Fog.mock!
|
63
|
+
sharedstorage.stub(:service, service) do
|
64
|
+
sharedstorage.create.must_be_kind_of(Hash)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
=begin
|
70
|
+
describe 'when missing parameter' do
|
71
|
+
before :each do
|
72
|
+
sharedstorage.quantity = nil
|
73
|
+
Fog.mock!
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should raise ArgumentError' do
|
77
|
+
sharedstorage.stub(:service, service) do
|
78
|
+
sharedstorage.create.must_raise(ArgumentError)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
=end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/sharedstorages'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::SharedStorages do
|
5
|
+
subject { Fog::ArubaCloud::Compute::SharedStorages }
|
6
|
+
|
7
|
+
it 'should be a collection of SharedStorage' do
|
8
|
+
subject.model.must_equal(Fog::ArubaCloud::Compute::SharedStorage)
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/snapshot'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::Snapshot do
|
5
|
+
include ModelSetup
|
6
|
+
|
7
|
+
let (:snapshot_class) do
|
8
|
+
class Fog::ArubaCloud::Compute::Snapshot
|
9
|
+
def self.read_identity
|
10
|
+
instance_variable_get('@identity')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
Fog::ArubaCloud::Compute::Snapshot
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:service) { Object.new }
|
17
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/snapshots'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::Snapshot do
|
5
|
+
subject { Fog::ArubaCloud::Compute::Snapshots }
|
6
|
+
|
7
|
+
it 'should be a collection of Snapshot' do
|
8
|
+
subject.model.must_equal(Fog::ArubaCloud::Compute::Snapshot)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/template'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::Template do
|
5
|
+
include ModelSetup
|
6
|
+
|
7
|
+
let (:template_class) do
|
8
|
+
class Fog::ArubaCloud::Compute::Template
|
9
|
+
def self.read_identity
|
10
|
+
instance_variable_get('@identity')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
Fog::ArubaCloud::Compute::Template
|
14
|
+
end
|
15
|
+
|
16
|
+
#let(:service) { Object.new }
|
17
|
+
let(:template) { Fog::ArubaCloud::Compute::Template.new }
|
18
|
+
|
19
|
+
before :each do
|
20
|
+
Fog.unmock!
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should have an unique id' do
|
24
|
+
template_class.read_identity.must_equal(:id)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should have 8 attributes' do
|
28
|
+
template_class.attributes.must_equal([
|
29
|
+
:id,
|
30
|
+
:name,
|
31
|
+
:description,
|
32
|
+
:enabled,
|
33
|
+
:export_enabled,
|
34
|
+
:identification_code,
|
35
|
+
:product_id,
|
36
|
+
:hypervisor
|
37
|
+
])
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fog/arubacloud/compute/models/templates'
|
3
|
+
|
4
|
+
describe Fog::ArubaCloud::Compute::Templates do
|
5
|
+
subject { Fog::ArubaCloud::Compute::Templates.new }
|
6
|
+
|
7
|
+
it 'should be a collection of Template' do
|
8
|
+
subject.model.must_equal(Fog::ArubaCloud::Compute::Template)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should respond to #all' do
|
12
|
+
subject.must_respond_to :all
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should respond to #get_hypervisor' do
|
16
|
+
subject.must_respond_to :get_hypervisor
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
end
|
@@ -1,15 +1,16 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'fog/arubacloud/compute'
|
2
3
|
|
3
|
-
describe Fog::Compute
|
4
|
+
describe Fog::ArubaCloud::Compute do
|
4
5
|
describe 'it create the provider object' do
|
5
6
|
|
6
7
|
before do
|
7
8
|
@arguments = {
|
8
9
|
:arubacloud_username => '',
|
9
10
|
:arubacloud_password => '',
|
10
|
-
:url
|
11
|
+
:url => ''
|
11
12
|
}
|
12
|
-
@service = Fog::Compute
|
13
|
+
@service = Fog::ArubaCloud::Compute.new(@arguments)
|
13
14
|
end
|
14
15
|
|
15
16
|
it 'respond to #request' do
|
@@ -25,7 +26,23 @@ describe Fog::Compute::ArubaCloud do
|
|
25
26
|
end
|
26
27
|
|
27
28
|
it 'respond to #servers' do
|
28
|
-
assert @service.respond_to?
|
29
|
+
assert @service.respond_to?(:servers)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'respond to #templates' do
|
33
|
+
assert @service.respond_to?(:templates)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'respond to #loadbalancers' do
|
37
|
+
assert @service.respond_to?(:loadbalancers)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'respond to #schedules' do
|
41
|
+
assert @service.respond_to?(:schedules)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'respond to #disks' do
|
45
|
+
assert @service.respond_to?(:disks)
|
29
46
|
end
|
30
47
|
|
31
48
|
end
|