fog-profitbricks 0.0.5 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +1465 -4
- data/Rakefile +3 -0
- data/examples/pb_demo.rb +83 -35
- data/fog-profitbricks.gemspec +10 -10
- data/gemfiles/Gemfile.1.8.7 +0 -1
- data/lib/fog/profitbricks.rb +4 -23
- data/lib/fog/profitbricks/compute.rb +1082 -1
- data/lib/fog/profitbricks/helpers/compute/data_helper.rb +12 -0
- data/lib/fog/profitbricks/models/base.rb +37 -0
- data/lib/fog/profitbricks/models/compute/datacenter.rb +64 -0
- data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/datacenters.rb +9 -4
- data/lib/fog/profitbricks/models/compute/firewall_rule.rb +101 -0
- data/lib/fog/profitbricks/models/compute/firewall_rules.rb +40 -0
- data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/flavor.rb +0 -0
- data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/flavors.rb +0 -0
- data/lib/fog/profitbricks/models/compute/image.rb +72 -0
- data/lib/fog/profitbricks/models/compute/images.rb +28 -0
- data/lib/fog/profitbricks/models/compute/ip_block.rb +58 -0
- data/lib/fog/profitbricks/models/compute/ip_blocks.rb +30 -0
- data/lib/fog/profitbricks/models/compute/lan.rb +89 -0
- data/lib/fog/profitbricks/models/compute/lans.rb +36 -0
- data/lib/fog/profitbricks/models/compute/load_balancer.rb +126 -0
- data/lib/fog/profitbricks/models/compute/load_balancers.rb +34 -0
- data/lib/fog/profitbricks/models/compute/location.rb +18 -0
- data/lib/fog/profitbricks/models/compute/locations.rb +28 -0
- data/lib/fog/profitbricks/models/compute/nic.rb +111 -0
- data/lib/fog/profitbricks/models/compute/nics.rb +38 -0
- data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/region.rb +0 -0
- data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/regions.rb +0 -0
- data/lib/fog/profitbricks/models/compute/request.rb +24 -0
- data/lib/fog/profitbricks/models/compute/requests.rb +37 -0
- data/lib/fog/profitbricks/models/compute/server.rb +263 -0
- data/lib/fog/profitbricks/models/compute/servers.rb +32 -0
- data/lib/fog/profitbricks/models/compute/snapshot.rb +81 -0
- data/lib/fog/profitbricks/models/compute/snapshots.rb +28 -0
- data/lib/fog/profitbricks/models/compute/volume.rb +123 -0
- data/lib/fog/profitbricks/models/compute/volumes.rb +33 -0
- data/lib/fog/profitbricks/requests/compute/associate_nic_to_load_balancer.rb +104 -0
- data/lib/fog/profitbricks/requests/compute/attach_cdrom.rb +88 -0
- data/lib/fog/profitbricks/requests/compute/attach_volume.rb +89 -0
- data/lib/fog/profitbricks/requests/compute/create_datacenter.rb +89 -0
- data/lib/fog/profitbricks/requests/compute/create_firewall_rule.rb +103 -0
- data/lib/fog/{compute/profit_bricks/requests → profitbricks/requests/compute}/create_flavor.rb +0 -0
- data/lib/fog/profitbricks/requests/compute/create_ip_block.rb +81 -0
- data/lib/fog/profitbricks/requests/compute/create_lan.rb +160 -0
- data/lib/fog/profitbricks/requests/compute/create_load_balancer.rb +87 -0
- data/lib/fog/profitbricks/requests/compute/create_nic.rb +124 -0
- data/lib/fog/profitbricks/requests/compute/create_server.rb +257 -0
- data/lib/fog/profitbricks/requests/compute/create_volume.rb +133 -0
- data/lib/fog/profitbricks/requests/compute/create_volume_snapshot.rb +113 -0
- data/lib/fog/profitbricks/requests/compute/delete_datacenter.rb +43 -0
- data/lib/fog/profitbricks/requests/compute/delete_firewall_rule.rb +47 -0
- data/lib/fog/profitbricks/requests/compute/delete_image.rb +43 -0
- data/lib/fog/profitbricks/requests/compute/delete_ip_block.rb +43 -0
- data/lib/fog/profitbricks/requests/compute/delete_lan.rb +44 -0
- data/lib/fog/profitbricks/requests/compute/delete_load_balancer.rb +44 -0
- data/lib/fog/profitbricks/requests/compute/delete_nic.rb +46 -0
- data/lib/fog/profitbricks/requests/compute/delete_server.rb +48 -0
- data/lib/fog/profitbricks/requests/compute/delete_snapshot.rb +43 -0
- data/lib/fog/profitbricks/requests/compute/delete_volume.rb +44 -0
- data/lib/fog/profitbricks/requests/compute/detach_cdrom.rb +52 -0
- data/lib/fog/profitbricks/requests/compute/detach_volume.rb +53 -0
- data/lib/fog/profitbricks/requests/compute/get_all_datacenters.rb +59 -0
- data/lib/fog/profitbricks/requests/compute/get_all_firewall_rules.rb +76 -0
- data/lib/fog/{compute/profit_bricks/requests → profitbricks/requests/compute}/get_all_flavors.rb +0 -0
- data/lib/fog/profitbricks/requests/compute/get_all_images.rb +66 -0
- data/lib/fog/profitbricks/requests/compute/get_all_ip_blocks.rb +56 -0
- data/lib/fog/profitbricks/requests/compute/get_all_lans.rb +120 -0
- data/lib/fog/profitbricks/requests/compute/get_all_load_balanced_nics.rb +100 -0
- data/lib/fog/profitbricks/requests/compute/get_all_load_balancers.rb +117 -0
- data/lib/fog/profitbricks/requests/compute/get_all_locations.rb +44 -0
- data/lib/fog/profitbricks/requests/compute/get_all_nic.rb +102 -0
- data/lib/fog/profitbricks/requests/compute/get_all_requests.rb +43 -0
- data/lib/fog/profitbricks/requests/compute/get_all_servers.rb +134 -0
- data/lib/fog/profitbricks/requests/compute/get_all_snapshots.rb +66 -0
- data/lib/fog/profitbricks/requests/compute/get_all_volumes.rb +78 -0
- data/lib/fog/profitbricks/requests/compute/get_attached_cdrom.rb +78 -0
- data/lib/fog/profitbricks/requests/compute/get_attached_volume.rb +79 -0
- data/lib/fog/profitbricks/requests/compute/get_datacenter.rb +65 -0
- data/lib/fog/profitbricks/requests/compute/get_firewall_rule.rb +71 -0
- data/lib/fog/{compute/profit_bricks/requests → profitbricks/requests/compute}/get_flavor.rb +0 -0
- data/lib/fog/profitbricks/requests/compute/get_image.rb +71 -0
- data/lib/fog/profitbricks/requests/compute/get_ip_block.rb +58 -0
- data/lib/fog/profitbricks/requests/compute/get_lan.rb +120 -0
- data/lib/fog/profitbricks/requests/compute/get_load_balanced_nic.rb +99 -0
- data/lib/fog/profitbricks/requests/compute/get_load_balancer.rb +116 -0
- data/lib/fog/profitbricks/requests/compute/get_location.rb +49 -0
- data/lib/fog/profitbricks/requests/compute/get_nic.rb +98 -0
- data/lib/fog/profitbricks/requests/compute/get_request.rb +61 -0
- data/lib/fog/profitbricks/requests/compute/get_request_status.rb +50 -0
- data/lib/fog/profitbricks/requests/compute/get_server.rb +133 -0
- data/lib/fog/profitbricks/requests/compute/get_snapshot.rb +70 -0
- data/lib/fog/profitbricks/requests/compute/get_volume.rb +73 -0
- data/lib/fog/profitbricks/requests/compute/list_attached_cdroms.rb +74 -0
- data/lib/fog/profitbricks/requests/compute/list_attached_volumes.rb +75 -0
- data/lib/fog/profitbricks/requests/compute/reboot_server.rb +47 -0
- data/lib/fog/profitbricks/requests/compute/remove_nic_association.rb +44 -0
- data/lib/fog/profitbricks/requests/compute/restore_volume_snapshot.rb +61 -0
- data/lib/fog/profitbricks/requests/compute/start_server.rb +49 -0
- data/lib/fog/profitbricks/requests/compute/stop_server.rb +50 -0
- data/lib/fog/profitbricks/requests/compute/update_datacenter.rb +73 -0
- data/lib/fog/profitbricks/requests/compute/update_firewall_rule.rb +87 -0
- data/lib/fog/profitbricks/requests/compute/update_image.rb +90 -0
- data/lib/fog/profitbricks/requests/compute/update_lan.rb +126 -0
- data/lib/fog/profitbricks/requests/compute/update_load_balancer.rb +70 -0
- data/lib/fog/profitbricks/requests/compute/update_nic.rb +107 -0
- data/lib/fog/profitbricks/requests/compute/update_server.rb +147 -0
- data/lib/fog/profitbricks/requests/compute/update_snapshot.rb +90 -0
- data/lib/fog/profitbricks/requests/compute/update_volume.rb +82 -0
- data/lib/fog/profitbricks/version.rb +1 -1
- data/tests/profitbricks/requests/compute/composite_create_tests.rb +241 -0
- data/tests/profitbricks/requests/compute/location_tests.rb +24 -12
- data/tests/profitbricks/requests/compute/nic_tests.rb +290 -0
- data/tests/profitbricks/requests/compute/request_tests.rb +52 -0
- data/tests/profitbricks/requests/compute/server_tests.rb +398 -175
- metadata +140 -133
- data/lib/fog/compute/profit_bricks.rb +0 -217
- data/lib/fog/compute/profit_bricks/models/datacenter.rb +0 -60
- data/lib/fog/compute/profit_bricks/models/image.rb +0 -27
- data/lib/fog/compute/profit_bricks/models/images.rb +0 -22
- data/lib/fog/compute/profit_bricks/models/interface.rb +0 -61
- data/lib/fog/compute/profit_bricks/models/interfaces.rb +0 -23
- data/lib/fog/compute/profit_bricks/models/server.rb +0 -104
- data/lib/fog/compute/profit_bricks/models/servers.rb +0 -22
- data/lib/fog/compute/profit_bricks/models/volume.rb +0 -71
- data/lib/fog/compute/profit_bricks/models/volumes.rb +0 -23
- data/lib/fog/compute/profit_bricks/requests/clear_data_center.rb +0 -51
- data/lib/fog/compute/profit_bricks/requests/connect_storage_to_server.rb +0 -83
- data/lib/fog/compute/profit_bricks/requests/create_data_center.rb +0 -62
- data/lib/fog/compute/profit_bricks/requests/create_nic.rb +0 -79
- data/lib/fog/compute/profit_bricks/requests/create_server.rb +0 -105
- data/lib/fog/compute/profit_bricks/requests/create_storage.rb +0 -96
- data/lib/fog/compute/profit_bricks/requests/delete_data_center.rb +0 -60
- data/lib/fog/compute/profit_bricks/requests/delete_nic.rb +0 -64
- data/lib/fog/compute/profit_bricks/requests/delete_server.rb +0 -64
- data/lib/fog/compute/profit_bricks/requests/delete_storage.rb +0 -64
- data/lib/fog/compute/profit_bricks/requests/disconnect_storage_from_server.rb +0 -76
- data/lib/fog/compute/profit_bricks/requests/get_all_data_centers.rb +0 -31
- data/lib/fog/compute/profit_bricks/requests/get_all_images.rb +0 -65
- data/lib/fog/compute/profit_bricks/requests/get_all_locations.rb +0 -44
- data/lib/fog/compute/profit_bricks/requests/get_all_nic.rb +0 -53
- data/lib/fog/compute/profit_bricks/requests/get_all_servers.rb +0 -57
- data/lib/fog/compute/profit_bricks/requests/get_all_storages.rb +0 -56
- data/lib/fog/compute/profit_bricks/requests/get_data_center.rb +0 -38
- data/lib/fog/compute/profit_bricks/requests/get_data_center_state.rb +0 -42
- data/lib/fog/compute/profit_bricks/requests/get_image.rb +0 -69
- data/lib/fog/compute/profit_bricks/requests/get_location.rb +0 -48
- data/lib/fog/compute/profit_bricks/requests/get_nic.rb +0 -63
- data/lib/fog/compute/profit_bricks/requests/get_server.rb +0 -98
- data/lib/fog/compute/profit_bricks/requests/get_storage.rb +0 -63
- data/lib/fog/compute/profit_bricks/requests/reset_server.rb +0 -49
- data/lib/fog/compute/profit_bricks/requests/set_internet_access.rb +0 -59
- data/lib/fog/compute/profit_bricks/requests/start_server.rb +0 -58
- data/lib/fog/compute/profit_bricks/requests/stop_server.rb +0 -58
- data/lib/fog/compute/profit_bricks/requests/update_data_center.rb +0 -54
- data/lib/fog/compute/profit_bricks/requests/update_nic.rb +0 -74
- data/lib/fog/compute/profit_bricks/requests/update_server.rb +0 -79
- data/lib/fog/compute/profit_bricks/requests/update_storage.rb +0 -73
- data/lib/fog/models/profit_bricks/base.rb +0 -11
- data/lib/fog/parsers/compute.rb +0 -37
- data/lib/fog/parsers/compute/profit_bricks/base.rb +0 -51
- data/lib/fog/parsers/compute/profit_bricks/clear_data_center.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/connect_storage_to_server.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/create_data_center.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/create_nic.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/create_server.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/create_storage.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/delete_data_center.rb +0 -20
- data/lib/fog/parsers/compute/profit_bricks/delete_nic.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/delete_server.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/delete_storage.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/disconnect_storage_from_server.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/get_all_data_centers.rb +0 -26
- data/lib/fog/parsers/compute/profit_bricks/get_all_images.rb +0 -30
- data/lib/fog/parsers/compute/profit_bricks/get_all_nic.rb +0 -30
- data/lib/fog/parsers/compute/profit_bricks/get_all_servers.rb +0 -57
- data/lib/fog/parsers/compute/profit_bricks/get_all_storages.rb +0 -33
- data/lib/fog/parsers/compute/profit_bricks/get_data_center.rb +0 -23
- data/lib/fog/parsers/compute/profit_bricks/get_data_center_state.rb +0 -20
- data/lib/fog/parsers/compute/profit_bricks/get_image.rb +0 -26
- data/lib/fog/parsers/compute/profit_bricks/get_nic.rb +0 -27
- data/lib/fog/parsers/compute/profit_bricks/get_server.rb +0 -57
- data/lib/fog/parsers/compute/profit_bricks/get_storage.rb +0 -30
- data/lib/fog/parsers/compute/profit_bricks/reset_server.rb +0 -20
- data/lib/fog/parsers/compute/profit_bricks/set_internet_access.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/update_data_center.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/update_nic.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/update_server.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/update_storage.rb +0 -22
- data/lib/fog/profitbricks/storage.rb +0 -1
- data/tests/profitbricks/requests/compute/image_tests.rb +0 -50
- data/tests/profitbricks/requests/compute/interface_tests.rb +0 -101
@@ -0,0 +1,52 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:profitbricks] | request request', ['profitbricks', 'compute']) do
|
2
|
+
|
3
|
+
@requests_schema = {
|
4
|
+
'id' => String,
|
5
|
+
'type' => String,
|
6
|
+
'href' => String,
|
7
|
+
'items' => Array
|
8
|
+
}
|
9
|
+
|
10
|
+
@request_schema = {
|
11
|
+
'id' => String,
|
12
|
+
'type' => String,
|
13
|
+
'href' => String,
|
14
|
+
'metadata' => Hash,
|
15
|
+
'properties' => Hash
|
16
|
+
}
|
17
|
+
|
18
|
+
service = Fog::Compute[:profitbricks]
|
19
|
+
|
20
|
+
tests('success') do
|
21
|
+
|
22
|
+
Excon.defaults[:connection_timeout] = 500
|
23
|
+
|
24
|
+
tests('#get_all_requests').data_matches_schema(@requests_schema) do
|
25
|
+
data = service.get_all_requests
|
26
|
+
|
27
|
+
@request_id = data.body['items'][0]['id']
|
28
|
+
|
29
|
+
data.body
|
30
|
+
end
|
31
|
+
|
32
|
+
tests('#get_request').data_matches_schema(@request_schema) do
|
33
|
+
data = service.get_request(@request_id)
|
34
|
+
data.body
|
35
|
+
end
|
36
|
+
|
37
|
+
tests('#get_request_status').data_matches_schema(@request_schema) do
|
38
|
+
data = service.get_request(@request_id)
|
39
|
+
data.body
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
tests('failure') do
|
44
|
+
tests('#get_location').raises(ArgumentError) do
|
45
|
+
service.get_request
|
46
|
+
end
|
47
|
+
|
48
|
+
tests('#get_location_status').raises(ArgumentError) do
|
49
|
+
service.get_request_status
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -1,46 +1,18 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:profitbricks] | server request', ['profitbricks', 'compute']) do
|
2
2
|
|
3
|
-
@
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
'location' => String
|
3
|
+
@resource_schema = {
|
4
|
+
'id' => String,
|
5
|
+
'type' => String,
|
6
|
+
'href' => String,
|
7
|
+
'metadata' => Hash,
|
8
|
+
'properties' => Hash
|
10
9
|
}
|
11
10
|
|
12
|
-
@
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
'internetAccess' => String,
|
18
|
-
'connectedStorages' => Fog::Nullable::Array,
|
19
|
-
'nics' => Fog::Nullable::Array,
|
20
|
-
'provisioningState' => 'AVAILABLE',
|
21
|
-
'virtualMachineState' => 'RUNNING',
|
22
|
-
'creationTime' => Time,
|
23
|
-
'lastModificationTime' => Time,
|
24
|
-
'osType' => String,
|
25
|
-
'availabilityZone' => 'AUTO' || 'ZONE_1' || 'ZONE_2',
|
26
|
-
}
|
27
|
-
|
28
|
-
@storage_format = {
|
29
|
-
'dataCenterId' => String,
|
30
|
-
'dataCenterVersion' => Integer,
|
31
|
-
'storageId' => String,
|
32
|
-
'size' => Integer,
|
33
|
-
'storageName' => String,
|
34
|
-
'mountImage' => Hash,
|
35
|
-
'provisioningState' => 'AVAILABLE',
|
36
|
-
'creationTime' => Time,
|
37
|
-
'lastModificationTime' => Time
|
38
|
-
}
|
39
|
-
|
40
|
-
@minimal_format = {
|
41
|
-
'requestId' => String,
|
42
|
-
'dataCenterId' => String,
|
43
|
-
'dataCenterVersion' => Integer
|
11
|
+
@minimal_schema_with_items = {
|
12
|
+
'id' => String,
|
13
|
+
'type' => String,
|
14
|
+
'href' => String,
|
15
|
+
'items' => Array
|
44
16
|
}
|
45
17
|
|
46
18
|
service = Fog::Compute[:profitbricks]
|
@@ -49,201 +21,452 @@ Shindo.tests('Fog::Compute[:profitbricks] | server request', ['profitbricks', 'c
|
|
49
21
|
|
50
22
|
Excon.defaults[:connection_timeout] = 500
|
51
23
|
|
52
|
-
tests('#
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
# puts '#get_all_data_centers'
|
72
|
-
data = service.get_all_data_centers
|
73
|
-
data.body['getAllDataCentersResponse'].find { |dc|
|
74
|
-
dc['dataCenterId'] == @data_center_id
|
75
|
-
}
|
24
|
+
tests('#create_datacenter').data_matches_schema(@resource_schema) do
|
25
|
+
options = {}
|
26
|
+
options[:name] = 'FogDataCenter'
|
27
|
+
options[:location] = 'us/las'
|
28
|
+
options[:description] = 'Part of server tests suite'
|
29
|
+
|
30
|
+
createDatacenterResponse = service.create_datacenter(options)
|
31
|
+
@datacenter_id = createDatacenterResponse.body['id']
|
32
|
+
|
33
|
+
if ENV["FOG_MOCK"] != "true"
|
34
|
+
service.datacenters.get(@datacenter_id).wait_for { ready? }
|
35
|
+
end
|
36
|
+
|
37
|
+
createDatacenterResponse.body
|
38
|
+
end
|
39
|
+
|
40
|
+
tests('#get_datacenter').data_matches_schema(@resource_schema) do
|
41
|
+
getDatacenterResponse = service.get_datacenter(@datacenter_id)
|
42
|
+
getDatacenterResponse.body
|
76
43
|
end
|
77
44
|
|
78
|
-
tests('#
|
79
|
-
|
80
|
-
|
81
|
-
|
45
|
+
tests('#get_all_datacenters').data_matches_schema(@minimal_schema_with_items) do
|
46
|
+
getAllDatacentersResponse = service.get_all_datacenters
|
47
|
+
getAllDatacentersResponse.body
|
48
|
+
end
|
49
|
+
|
50
|
+
tests('#update_datacenter').data_matches_schema(@resource_schema) do
|
51
|
+
options = {}
|
52
|
+
options[:name] = 'FogDataCenterRename'
|
53
|
+
options[:description] = 'FogDataCenterDescriptionUpdated'
|
54
|
+
|
55
|
+
updateDatacenterResponse = service.update_datacenter(
|
56
|
+
@datacenter_id, options
|
82
57
|
)
|
83
|
-
|
58
|
+
|
59
|
+
if ENV["FOG_MOCK"] != "true"
|
60
|
+
service.datacenters.get(@datacenter_id).wait_for { ready? }
|
61
|
+
end
|
62
|
+
|
63
|
+
updateDatacenterResponse.body
|
84
64
|
end
|
85
65
|
|
86
|
-
tests('#get_all_images') do
|
87
|
-
|
88
|
-
data = service.get_all_images.body['
|
89
|
-
image['location'] == 'us/las' &&
|
90
|
-
image['imageType'] == '
|
91
|
-
image['
|
66
|
+
tests('#get_all_images').data_matches_schema(@minimal_schema_with_items) do
|
67
|
+
getAllImagesResponse = service.get_all_images
|
68
|
+
data = service.get_all_images.body['items'].find { |image|
|
69
|
+
image['properties']['location'] == 'us/las' &&
|
70
|
+
image['properties']['imageType'] == 'CDROM' &&
|
71
|
+
image['properties']['licenceType'] == 'LINUX'
|
92
72
|
}
|
93
|
-
@image_id = data['
|
73
|
+
@image_id = data['id']
|
74
|
+
getAllImagesResponse.body
|
94
75
|
end
|
95
76
|
|
96
|
-
tests('#
|
97
|
-
|
98
|
-
|
99
|
-
@data_center_id, 5, {
|
100
|
-
'storageName' => 'FogVolume',
|
101
|
-
'mountImageId' => @image_id
|
102
|
-
}
|
103
|
-
)
|
104
|
-
@storage_id = data.body['createStorageResponse']['storageId']
|
105
|
-
service.volumes.get(@storage_id).wait_for { ready? }
|
106
|
-
data.body['createStorageResponse']
|
77
|
+
tests('#get_image').data_matches_schema(@resource_schema) do
|
78
|
+
getImageResponse = service.get_image(@image_id)
|
79
|
+
getImageResponse.body
|
107
80
|
end
|
108
81
|
|
109
|
-
|
110
|
-
|
111
|
-
|
82
|
+
if ENV["FOG_MOCK"] == "true"
|
83
|
+
tests('#update_image').data_matches_schema(@resource_schema) do
|
84
|
+
options = {}
|
85
|
+
options[:name] = 'FogImageRename'
|
86
|
+
options[:description] = 'FogImageDescriptionUpdated'
|
87
|
+
|
88
|
+
updateImageResponse = service.update_image(
|
89
|
+
@image_id, options
|
90
|
+
)
|
91
|
+
|
92
|
+
updateImageResponse.body
|
93
|
+
end
|
112
94
|
end
|
113
95
|
|
114
|
-
tests('#
|
115
|
-
|
116
|
-
|
117
|
-
data.body['getAllStoragesResponse'].find {
|
118
|
-
|storage| storage['storageId'] == @storage_id
|
96
|
+
tests('#get_all_volumes').data_matches_schema(@minimal_schema_with_items) do
|
97
|
+
if dc = service.get_all_datacenters.body["items"].find {
|
98
|
+
|datacenter| datacenter["id"] == @datacenter_id
|
119
99
|
}
|
100
|
+
else
|
101
|
+
raise Fog::Errors::NotFound.new("The requested resource could not be found")
|
102
|
+
end
|
103
|
+
|
104
|
+
getAllVolumesResponse = service.get_all_volumes(dc['id'])
|
105
|
+
getAllVolumesResponse.body
|
120
106
|
end
|
121
107
|
|
122
|
-
tests('#
|
123
|
-
|
124
|
-
|
108
|
+
tests('#create_volume').data_matches_schema(@resource_schema) do
|
109
|
+
options = {}
|
110
|
+
options[:name] = 'FogRestTestVolume'
|
111
|
+
options[:size] = 5
|
112
|
+
options[:licenceType] = 'LINUX'
|
113
|
+
options[:type] = 'HDD'
|
114
|
+
|
115
|
+
createVolumeResponse = service.create_volume(@datacenter_id, options)
|
116
|
+
@volume_id = createVolumeResponse.body['id']
|
117
|
+
|
118
|
+
if ENV["FOG_MOCK"] != "true"
|
119
|
+
loop do
|
120
|
+
sleep(5)
|
121
|
+
vlm = service.volumes.get(@datacenter_id, @volume_id)
|
122
|
+
break unless !vlm.ready?
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# Calling wait_for causes ArgumentError
|
127
|
+
# vlm.wait_for { ready? }
|
128
|
+
|
129
|
+
createVolumeResponse.body
|
125
130
|
end
|
126
131
|
|
127
|
-
tests('#
|
128
|
-
|
129
|
-
|
130
|
-
'serverName' => 'FogServer',
|
131
|
-
'bootFromStorageId' => @storage_id
|
132
|
-
})
|
133
|
-
@server_id = data.body['createServerResponse']['serverId']
|
134
|
-
service.servers.get(@server_id).wait_for { ready? }
|
135
|
-
data.body['createServerResponse']
|
132
|
+
tests('#get_volume').data_matches_schema(@resource_schema) do
|
133
|
+
getVolumeResponse = service.get_volume(@datacenter_id, @volume_id)
|
134
|
+
getVolumeResponse.body
|
136
135
|
end
|
137
136
|
|
138
|
-
tests('#
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
137
|
+
tests('#create_volume_snapshot').data_matches_schema(@resource_schema) do
|
138
|
+
options = {}
|
139
|
+
options[:name] = 'FogRestTestSnapshot'
|
140
|
+
options[:description] = 'Testing fog create snapshot'
|
141
|
+
|
142
|
+
createVolumeSnapshotResponse = service.create_volume_snapshot(@datacenter_id, @volume_id, options)
|
143
|
+
@snapshot_id = createVolumeSnapshotResponse.body['id']
|
144
|
+
|
145
|
+
if ENV["FOG_MOCK"] != "true"
|
146
|
+
sleep(5)
|
147
|
+
snapshot = service.snapshots.get(@snapshot_id)
|
148
|
+
snapshot.wait_for { ready? }
|
149
|
+
end
|
150
|
+
|
151
|
+
createVolumeSnapshotResponse.body
|
152
|
+
end
|
153
|
+
|
154
|
+
tests('#update_volume').data_matches_schema(@resource_schema) do
|
155
|
+
options = {}
|
156
|
+
options[:name] = 'FogRestTestVolumeRenamed'
|
157
|
+
options[:size] = 6
|
158
|
+
|
159
|
+
updateVolumeResponse = service.update_volume(@datacenter_id, @volume_id, options)
|
160
|
+
|
161
|
+
if ENV["FOG_MOCK"] != "true"
|
162
|
+
loop do
|
163
|
+
sleep(1)
|
164
|
+
vlm = service.volumes.get(@datacenter_id, @volume_id)
|
165
|
+
break unless !vlm.ready?
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# Calling wait_for causes ArgumentError
|
170
|
+
# vlm.wait_for { ready? }
|
171
|
+
|
172
|
+
updateVolumeResponse.body
|
173
|
+
end
|
174
|
+
|
175
|
+
tests('#update_snapshot').data_matches_schema(@resource_schema) do
|
176
|
+
options = {}
|
177
|
+
options[:name] = 'FogRestTestSnapshotRename'
|
178
|
+
options[:description] = 'Testing fog create snapshot - updated description'
|
179
|
+
options[:ramHotPlug] = true
|
180
|
+
|
181
|
+
updateSnapshotResponse = service.update_snapshot(@snapshot_id, options)
|
182
|
+
|
183
|
+
if ENV["FOG_MOCK"] != "true"
|
184
|
+
snapshot = service.snapshots.get(@snapshot_id)
|
185
|
+
snapshot.wait_for { ready? }
|
186
|
+
end
|
187
|
+
updateSnapshotResponse.body
|
188
|
+
end
|
189
|
+
|
190
|
+
tests('#get_snapshot').data_matches_schema(@resource_schema) do
|
191
|
+
getSnapshotResponse = service.get_snapshot(@snapshot_id)
|
192
|
+
getSnapshotResponse.body
|
193
|
+
end
|
194
|
+
|
195
|
+
tests('#restore_volume_snapshot').succeeds do
|
196
|
+
options = {}
|
197
|
+
options[:snapshot_id] = @snapshot_id
|
198
|
+
|
199
|
+
restoreVolumeSnapshotResponse = service.restore_volume_snapshot(@datacenter_id, @volume_id, options)
|
200
|
+
restoreVolumeSnapshotResponse.status == 202
|
201
|
+
end
|
202
|
+
|
203
|
+
tests('#get_all_snapshots').data_matches_schema(@minimal_schema_with_items) do
|
204
|
+
getAllSnapshotsResponse = service.get_all_snapshots
|
205
|
+
getAllSnapshotsResponse.body
|
206
|
+
end
|
207
|
+
|
208
|
+
tests('#create_server').data_matches_schema(@resource_schema) do
|
209
|
+
properties = {}
|
210
|
+
properties[:name] = 'FogTestServer_2'
|
211
|
+
properties[:cores] = 1
|
212
|
+
properties[:ram] = 1024
|
213
|
+
properties[:availabilityZone] = 'ZONE_1'
|
214
|
+
properties[:cpuFamily] = 'INTEL_XEON'
|
215
|
+
|
216
|
+
entities = {}
|
217
|
+
entities[:volumes] = {}
|
218
|
+
entities[:volumes]['items'] = [
|
219
|
+
{
|
220
|
+
'id' => @volume_id
|
221
|
+
}
|
222
|
+
]
|
223
|
+
|
224
|
+
createServerResponse = service.create_server(@datacenter_id, properties, entities)
|
225
|
+
@server_id = createServerResponse.body['id']
|
226
|
+
|
227
|
+
if ENV["FOG_MOCK"] != "true"
|
228
|
+
loop do
|
229
|
+
sleep(480)
|
230
|
+
server = service.servers.get(@datacenter_id, @server_id)
|
231
|
+
break unless !server.ready?
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
# Calling wait_for causes ArgumentError
|
236
|
+
# server.wait_for { ready? }
|
237
|
+
|
238
|
+
createServerResponse.body
|
146
239
|
end
|
147
240
|
|
148
|
-
tests('#get_server').
|
149
|
-
|
150
|
-
|
151
|
-
data.body['getServerResponse']
|
241
|
+
tests('#get_server').data_matches_schema(@resource_schema) do
|
242
|
+
getServerResponse = service.get_server(@datacenter_id, @server_id)
|
243
|
+
getServerResponse.body
|
152
244
|
end
|
153
245
|
|
154
|
-
tests('#
|
155
|
-
|
156
|
-
|
157
|
-
service.servers.get(@server_id).wait_for { ready? }
|
158
|
-
data.body['updateServerResponse']
|
246
|
+
tests('#list_attached_volumes').data_matches_schema(@minimal_schema_with_items) do
|
247
|
+
listAttachedVolumesResponse = service.list_attached_volumes(@datacenter_id, @server_id)
|
248
|
+
listAttachedVolumesResponse.body
|
159
249
|
end
|
160
250
|
|
161
|
-
tests('#
|
162
|
-
|
163
|
-
|
251
|
+
tests('#attach_volume').data_matches_schema(@resource_schema) do
|
252
|
+
attachVolumeResponse = service.attach_volume(@datacenter_id, @server_id, @volume_id)
|
253
|
+
|
254
|
+
if ENV["FOG_MOCK"] != "true"
|
255
|
+
loop do
|
256
|
+
vlm = service.volumes.get(@datacenter_id, @volume_id)
|
257
|
+
sleep(1)
|
258
|
+
break unless !vlm.ready?
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
# Calling wait_for causes ArgumentError
|
263
|
+
# vlm.wait_for { ready? }
|
264
|
+
|
265
|
+
attachVolumeResponse.body
|
266
|
+
end
|
267
|
+
|
268
|
+
tests('#get_attached_volume').data_matches_schema(@resource_schema) do
|
269
|
+
getAttachedVolumeResponse = service.get_attached_volume(@datacenter_id, @server_id, @volume_id)
|
270
|
+
getAttachedVolumeResponse.body
|
271
|
+
end
|
272
|
+
|
273
|
+
tests('#detach_volume').succeeds do
|
274
|
+
detachVolumeResponse = service.detach_volume(@datacenter_id, @server_id, @volume_id)
|
275
|
+
detachVolumeResponse.status == 202
|
276
|
+
end
|
277
|
+
|
278
|
+
tests('#attach_cdrom').data_matches_schema(@resource_schema) do
|
279
|
+
attachCdromResponse = service.attach_cdrom(@datacenter_id, @server_id, @image_id)
|
280
|
+
|
281
|
+
if ENV["FOG_MOCK"] != "true"
|
282
|
+
cd = service.images.get(@image_id)
|
283
|
+
cd.wait_for { ready? }
|
284
|
+
end
|
285
|
+
|
286
|
+
@cdrom_id = attachCdromResponse.body['id']
|
287
|
+
|
288
|
+
attachCdromResponse.body
|
289
|
+
end
|
290
|
+
|
291
|
+
tests('#get_attached_cdrom').data_matches_schema(@resource_schema) do
|
292
|
+
if ENV["FOG_MOCK"] != "true"
|
293
|
+
sleep(240)
|
294
|
+
end
|
295
|
+
getAttachedVolumeResponse = service.get_attached_cdrom(@datacenter_id, @server_id, @cdrom_id)
|
296
|
+
getAttachedVolumeResponse.body
|
297
|
+
end
|
298
|
+
|
299
|
+
tests('#list_attached_cdroms').data_matches_schema(@minimal_schema_with_items) do
|
300
|
+
listAttachedCdromsResponse = service.list_attached_cdroms(@datacenter_id, @server_id)
|
301
|
+
|
302
|
+
listAttachedCdromsResponse.body
|
303
|
+
end
|
304
|
+
|
305
|
+
tests('#detach_cdrom').succeeds do
|
306
|
+
detachVolumeResponse = service.detach_cdrom(@datacenter_id, @server_id, @cdrom_id)
|
307
|
+
detachVolumeResponse.status == 202
|
308
|
+
end
|
309
|
+
|
310
|
+
tests('#update_server').data_matches_schema(@resource_schema) do
|
311
|
+
updateServerResponse = service.update_server(@datacenter_id, @server_id, { 'name' => 'FogServerRename' })
|
312
|
+
|
313
|
+
if ENV["FOG_MOCK"] != "true"
|
314
|
+
loop do
|
315
|
+
server = service.servers.get(@datacenter_id, @server_id)
|
316
|
+
sleep(1)
|
317
|
+
break unless !server.ready?
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
# Calling wait_for causes ArgumentError
|
322
|
+
# server.wait_for { ready? }
|
323
|
+
|
324
|
+
updateServerResponse.body
|
325
|
+
end
|
326
|
+
|
327
|
+
tests('#get_all_servers').data_matches_schema(@minimal_schema_with_items) do
|
328
|
+
getAllServersResponse = service.get_all_servers(@datacenter_id)
|
329
|
+
|
330
|
+
getAllServersResponse.body
|
164
331
|
end
|
165
332
|
|
166
333
|
tests('#stop_server').succeeds do
|
167
|
-
|
168
|
-
|
169
|
-
|
334
|
+
stopServerResponse = service.stop_server(@datacenter_id, @server_id)
|
335
|
+
|
336
|
+
if ENV["FOG_MOCK"] != "true"
|
337
|
+
loop do
|
338
|
+
server = service.servers.get(@datacenter_id, @server_id)
|
339
|
+
sleep(1)
|
340
|
+
break unless !server.shutoff?
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
# Calling wait_for causes ArgumentError
|
345
|
+
# server.wait_for { shutoff? }
|
346
|
+
|
347
|
+
stopServerResponse.status == 202
|
170
348
|
end
|
171
349
|
|
172
350
|
tests('#start_server').succeeds do
|
173
|
-
|
174
|
-
|
175
|
-
|
351
|
+
startServerResponse = service.start_server(@datacenter_id, @server_id)
|
352
|
+
|
353
|
+
if ENV["FOG_MOCK"] != "true"
|
354
|
+
loop do
|
355
|
+
server = service.servers.get(@datacenter_id, @server_id)
|
356
|
+
sleep(1)
|
357
|
+
break unless !server.running?
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
# Calling wait_for causes ArgumentError
|
362
|
+
# server.wait_for { running? }
|
363
|
+
|
364
|
+
startServerResponse.status == 202
|
176
365
|
end
|
177
366
|
|
178
|
-
tests('#
|
179
|
-
|
180
|
-
|
181
|
-
|
367
|
+
tests('#reboot_server').succeeds do
|
368
|
+
rebootServerResponse = service.reboot_server(@datacenter_id, @server_id)
|
369
|
+
|
370
|
+
if ENV["FOG_MOCK"] != "true"
|
371
|
+
loop do
|
372
|
+
server = service.servers.get(@datacenter_id, @server_id)
|
373
|
+
sleep(1)
|
374
|
+
break unless !server.running?
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
rebootServerResponse.status == 202
|
182
379
|
end
|
183
380
|
|
184
|
-
tests('#
|
185
|
-
|
186
|
-
|
381
|
+
tests('#delete_server').succeeds do
|
382
|
+
deleteServerResponse = service.delete_server(@datacenter_id, @server_id)
|
383
|
+
deleteServerResponse.status == 202
|
187
384
|
end
|
188
385
|
|
189
|
-
tests('#
|
190
|
-
|
191
|
-
|
192
|
-
data.body['deleteStorageResponse']
|
386
|
+
tests('#delete_snapshot').succeeds do
|
387
|
+
deleteSnapshotResponse = service.delete_snapshot(@snapshot_id)
|
388
|
+
deleteSnapshotResponse.status == 202
|
193
389
|
end
|
194
390
|
|
195
|
-
tests('#
|
196
|
-
|
197
|
-
|
198
|
-
data.body['deleteServerResponse']
|
391
|
+
tests('#delete_volume').succeeds do
|
392
|
+
deleteVolumeResponse = service.delete_volume(@datacenter_id, @volume_id)
|
393
|
+
deleteVolumeResponse.status == 202
|
199
394
|
end
|
200
395
|
|
201
|
-
|
202
|
-
|
203
|
-
|
396
|
+
if ENV["FOG_MOCK"] == "true"
|
397
|
+
tests('#delete_image').succeeds do
|
398
|
+
deleteImageResponse = service.delete_image(@image_id)
|
399
|
+
deleteImageResponse.status == 202
|
400
|
+
end
|
204
401
|
end
|
205
402
|
|
206
|
-
tests('#
|
207
|
-
|
208
|
-
|
403
|
+
tests('#delete_datacenter').succeeds do
|
404
|
+
deleteDatacenterResponse = service.delete_datacenter(@datacenter_id)
|
405
|
+
deleteDatacenterResponse.status == 202
|
209
406
|
end
|
210
407
|
end
|
211
408
|
|
212
409
|
tests('failure') do
|
213
410
|
|
214
|
-
tests('#
|
215
|
-
|
216
|
-
|
411
|
+
tests('#get_datacenter').raises(Fog::Errors::NotFound) do
|
412
|
+
service.get_datacenter('00000000-0000-0000-0000-000000000000')
|
413
|
+
end
|
414
|
+
|
415
|
+
tests('#update_datacenter').raises(Fog::Errors::NotFound) do
|
416
|
+
service.update_datacenter('00000000-0000-0000-0000-000000000000',
|
417
|
+
{ 'name' => 'FogTestDCRename' })
|
418
|
+
end
|
419
|
+
|
420
|
+
tests('#delete_datacenter').raises(Fog::Errors::NotFound) do
|
421
|
+
service.delete_datacenter('00000000-0000-0000-0000-000000000000')
|
217
422
|
end
|
218
423
|
|
219
|
-
tests('#
|
220
|
-
|
221
|
-
service.update_data_center('00000000-0000-0000-0000-000000000000',
|
222
|
-
{ 'dataCenterName' => 'FogTestDCRename' })
|
424
|
+
tests('#get_image').raises(Fog::Errors::NotFound) do
|
425
|
+
service.get_image('00000000-0000-0000-0000-000000000000')
|
223
426
|
end
|
224
427
|
|
225
|
-
tests('#
|
226
|
-
|
227
|
-
service.delete_data_center('00000000-0000-0000-0000-000000000000')
|
428
|
+
tests('#update_image').raises(Fog::Errors::NotFound) do
|
429
|
+
service.update_image('00000000-0000-0000-0000-000000000000', {})
|
228
430
|
end
|
229
|
-
|
230
|
-
|
231
|
-
service.
|
431
|
+
|
432
|
+
tests('#create_volume').raises(ArgumentError) do
|
433
|
+
service.create_volume
|
434
|
+
end
|
435
|
+
|
436
|
+
tests('#create_volume_snapshot').raises(ArgumentError) do
|
437
|
+
service.create_volume_snapshot
|
438
|
+
end
|
439
|
+
|
440
|
+
tests('#create_volume_snapshot').raises(Fog::Errors::NotFound) do
|
441
|
+
service.create_volume_snapshot('00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000', {})
|
442
|
+
end
|
443
|
+
|
444
|
+
tests('#get_snapshot').raises(Fog::Errors::NotFound) do
|
445
|
+
service.get_snapshot('00000000-0000-0000-0000-000000000000')
|
446
|
+
end
|
447
|
+
|
448
|
+
tests('#get_snapshot').raises(ArgumentError) do
|
449
|
+
service.get_snapshot
|
450
|
+
end
|
451
|
+
|
452
|
+
tests('#restore_volume_snapshot').raises(ArgumentError) do
|
453
|
+
service.restore_volume_snapshot
|
454
|
+
end
|
455
|
+
|
456
|
+
tests('#restore_volume_snapshot').raises(Fog::Errors::NotFound) do
|
457
|
+
service.restore_volume_snapshot('00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000', {})
|
232
458
|
end
|
233
459
|
|
234
|
-
tests('#
|
235
|
-
|
236
|
-
service.get_storage('00000000-0000-0000-0000-000000000000')
|
460
|
+
tests('#get_volume').raises(Fog::Errors::NotFound) do
|
461
|
+
service.get_volume('00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000')
|
237
462
|
end
|
238
463
|
|
239
|
-
tests('#
|
240
|
-
|
241
|
-
service.update_storage('00000000-0000-0000-0000-000000000000')
|
464
|
+
tests('#update_volume').raises(Fog::Errors::NotFound) do
|
465
|
+
service.update_volume('00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000')
|
242
466
|
end
|
243
467
|
|
244
|
-
tests('#
|
245
|
-
|
246
|
-
service.delete_storage('00000000-0000-0000-0000-000000000000')
|
468
|
+
tests('#delete_volume').raises(Fog::Errors::NotFound) do
|
469
|
+
service.delete_volume('00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000')
|
247
470
|
end
|
248
471
|
end
|
249
472
|
end
|