deltacloud-core 0.5.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/NOTICE +1 -1
- data/Rakefile +63 -21
- data/bin/deltacloudd +10 -6
- data/config.ru +62 -6
- data/config/drivers/ec2.yaml +8 -0
- data/config/drivers/fgcp.yaml +13 -0
- data/deltacloud-core.gemspec +10 -2
- data/lib/cimi/collections.rb +58 -0
- data/lib/cimi/collections/address_templates.rb +49 -0
- data/lib/cimi/collections/addresses.rb +74 -0
- data/lib/cimi/collections/cloud_entry_point.rb +37 -0
- data/lib/{deltacloud/helpers/conversion_helper.rb → cimi/collections/entity_metadata.rb} +24 -16
- data/lib/cimi/collections/machine_admins.rb +74 -0
- data/lib/cimi/collections/machine_configurations.rb +49 -0
- data/lib/cimi/collections/machine_images.rb +50 -0
- data/lib/cimi/collections/machines.rb +157 -0
- data/lib/cimi/collections/network_configurations.rb +47 -0
- data/lib/cimi/collections/network_templates.rb +48 -0
- data/lib/cimi/collections/networks.rb +125 -0
- data/lib/cimi/collections/routing_group_templates.rb +47 -0
- data/lib/cimi/collections/routing_groups.rb +48 -0
- data/lib/cimi/collections/volume_configurations.rb +48 -0
- data/lib/cimi/collections/volume_images.rb +50 -0
- data/lib/cimi/collections/volumes.rb +80 -0
- data/lib/cimi/collections/vsp_configurations.rb +48 -0
- data/lib/cimi/collections/vsp_templates.rb +50 -0
- data/lib/cimi/collections/vsps.rb +108 -0
- data/lib/cimi/dependencies.rb +1 -0
- data/lib/cimi/helpers.rb +116 -0
- data/lib/cimi/helpers/cimi_helper.rb +6 -2
- data/lib/cimi/models.rb +72 -0
- data/lib/cimi/{model → models}/action.rb +1 -1
- data/lib/cimi/models/address.rb +72 -0
- data/lib/cimi/models/address_collection.rb +34 -0
- data/lib/cimi/models/address_template.rb +54 -0
- data/lib/cimi/models/address_template_collection.rb +34 -0
- data/lib/cimi/{model → models}/base.rb +2 -2
- data/lib/cimi/{model → models}/cloud_entry_point.rb +3 -5
- data/lib/cimi/{model → models}/entity_metadata.rb +7 -6
- data/lib/cimi/{model → models}/entity_metadata_collection.rb +2 -2
- data/lib/cimi/{model → models}/errors.rb +8 -0
- data/lib/cimi/{model → models}/machine.rb +10 -10
- data/lib/cimi/{model → models}/machine_admin.rb +1 -1
- data/lib/cimi/{model → models}/machine_admin_collection.rb +2 -2
- data/lib/cimi/{model → models}/machine_collection.rb +2 -2
- data/lib/cimi/{model → models}/machine_configuration.rb +9 -6
- data/lib/cimi/{model → models}/machine_configuration_collection.rb +2 -2
- data/lib/cimi/{model → models}/machine_image.rb +1 -1
- data/lib/cimi/{model → models}/machine_image_collection.rb +2 -2
- data/lib/cimi/{model → models}/machine_template.rb +0 -0
- data/lib/cimi/{model → models}/machine_template_collection.rb +2 -2
- data/lib/cimi/models/network.rb +109 -0
- data/lib/cimi/{model → models}/network_collection.rb +2 -2
- data/lib/cimi/{model → models}/network_configuration.rb +3 -4
- data/lib/cimi/{model → models}/network_configuration_collection.rb +2 -2
- data/lib/cimi/models/network_template.rb +36 -0
- data/lib/cimi/models/network_template_collection.rb +35 -0
- data/lib/cimi/models/routing_group.rb +34 -0
- data/lib/cimi/models/routing_group_collection.rb +34 -0
- data/lib/cimi/models/routing_group_template.rb +34 -0
- data/lib/cimi/models/routing_group_template_collection.rb +35 -0
- data/lib/cimi/{model → models}/schema.rb +0 -0
- data/lib/cimi/{model → models}/volume.rb +4 -4
- data/lib/cimi/{model → models}/volume_collection.rb +2 -2
- data/lib/cimi/{model → models}/volume_configuration.rb +1 -1
- data/lib/cimi/{model → models}/volume_configuration_collection.rb +2 -2
- data/lib/cimi/{model → models}/volume_image.rb +1 -1
- data/lib/cimi/{model → models}/volume_image_collection.rb +2 -2
- data/lib/cimi/{model → models}/volume_template.rb +0 -0
- data/lib/cimi/{model → models}/volume_template_collection.rb +2 -2
- data/lib/cimi/models/vsp.rb +102 -0
- data/lib/cimi/models/vsp_collection.rb +34 -0
- data/lib/cimi/models/vsp_configuration.rb +40 -0
- data/lib/cimi/models/vsp_configuration_collection.rb +34 -0
- data/lib/cimi/models/vsp_template.rb +34 -0
- data/lib/cimi/models/vsp_template_collection.rb +34 -0
- data/lib/cimi/server.rb +27 -549
- data/lib/deltacloud/api.rb +79 -0
- data/lib/deltacloud/collections.rb +54 -0
- data/lib/deltacloud/collections/addresses.rb +91 -0
- data/lib/deltacloud/collections/buckets.rb +273 -0
- data/lib/deltacloud/collections/drivers.rb +51 -0
- data/lib/deltacloud/collections/firewalls.rb +116 -0
- data/lib/deltacloud/collections/hardware_profiles.rb +29 -0
- data/lib/deltacloud/collections/images.rb +73 -0
- data/lib/deltacloud/collections/instance_states.rb +59 -0
- data/lib/deltacloud/collections/instances.rb +113 -0
- data/lib/deltacloud/collections/keys.rb +61 -0
- data/lib/deltacloud/collections/load_balancers.rb +102 -0
- data/lib/deltacloud/collections/metrics.rb +28 -0
- data/lib/deltacloud/collections/realms.rb +28 -0
- data/lib/deltacloud/collections/storage_snapshots.rb +51 -0
- data/lib/deltacloud/collections/storage_volumes.rb +99 -0
- data/lib/deltacloud/core_ext.rb +14 -6
- data/lib/deltacloud/core_ext/string.rb +17 -5
- data/lib/deltacloud/drivers.rb +6 -42
- data/lib/deltacloud/drivers/azure/azure_driver.rb +0 -4
- data/lib/deltacloud/{base_driver → drivers}/base_driver.rb +56 -18
- data/lib/deltacloud/drivers/condor/condor_driver.rb +1 -8
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +142 -33
- data/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb +2 -6
- data/lib/deltacloud/{base_driver → drivers}/exceptions.rb +25 -2
- data/lib/deltacloud/drivers/features.rb +154 -0
- data/lib/deltacloud/drivers/fgcp/fgcp_client.rb +387 -0
- data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +1435 -0
- data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +8 -11
- data/lib/deltacloud/drivers/google/google_driver.rb +2 -5
- data/lib/deltacloud/drivers/mock/data/keys/test-key.yml +28 -0
- data/lib/deltacloud/drivers/mock/mock_client.rb +2 -2
- data/lib/deltacloud/drivers/mock/mock_driver.rb +58 -40
- data/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb +145 -0
- data/lib/deltacloud/drivers/opennebula/cloud_client.rb +107 -73
- data/lib/deltacloud/drivers/opennebula/occi_client.rb +285 -145
- data/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +189 -126
- data/lib/deltacloud/drivers/openstack/openstack_driver.rb +427 -8
- data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +7 -9
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +48 -66
- data/lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb +44 -51
- data/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb +7 -8
- data/lib/deltacloud/drivers/sbc/sbc_client.rb +1 -1
- data/lib/deltacloud/drivers/sbc/sbc_driver.rb +3 -3
- data/lib/deltacloud/drivers/terremark/terremark_driver.rb +8 -8
- data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +39 -13
- data/lib/deltacloud/drivers/vsphere/vsphere_filemanager.rb +1 -0
- data/lib/deltacloud/helpers.rb +79 -7
- data/lib/{sinatra/lazy_auth.rb → deltacloud/helpers/auth_helper.rb} +5 -9
- data/lib/deltacloud/helpers/{blob_stream.rb → blob_stream_helper.rb} +7 -7
- data/lib/deltacloud/helpers/deltacloud_helper.rb +286 -0
- data/lib/deltacloud/helpers/driver_helper.rb +58 -0
- data/lib/deltacloud/helpers/rabbit_helper.rb +34 -0
- data/lib/{sinatra/url_for.rb → deltacloud/helpers/url_helper.rb} +31 -9
- data/lib/deltacloud/models.rb +19 -17
- data/lib/deltacloud/models/bucket.rb +4 -0
- data/lib/deltacloud/{hardware_profile.rb → models/hardware_profile.rb} +4 -2
- data/lib/deltacloud/models/image.rb +1 -0
- data/lib/deltacloud/models/instance.rb +4 -2
- data/lib/deltacloud/models/instance_address.rb +4 -0
- data/lib/deltacloud/models/key.rb +4 -0
- data/lib/deltacloud/models/metric.rb +40 -0
- data/lib/deltacloud/{state_machine.rb → models/state_machine.rb} +18 -1
- data/lib/deltacloud/server.rb +41 -1222
- data/lib/deltacloud_rack.rb +79 -0
- data/lib/{cimi/model/network_template.rb → ec2/helpers.rb} +7 -10
- data/lib/{deltacloud/backend_capability.rb → ec2/helpers/errors.rb} +24 -29
- data/lib/ec2/helpers/result.rb +31 -0
- data/lib/ec2/query_parser.rb +152 -0
- data/lib/ec2/server.rb +70 -0
- data/lib/{deltacloud.rb → sinatra.rb} +7 -12
- data/lib/sinatra/rack_accept.rb +13 -7
- data/lib/sinatra/rack_driver_select.rb +1 -1
- data/lib/sinatra/rack_matrix_params.rb +1 -3
- data/public/images/metric.png +0 -0
- data/public/javascripts/jquery.mobile-1.0.1.min.js +177 -0
- data/public/stylesheets/jquery.mobile-1.0.1.min.css +2 -0
- data/public/stylesheets/new.css +10 -0
- data/support/fedora/deltacloud-core.spec +1 -1
- data/tests/api/common.rb +1 -0
- data/tests/api/driver_test.rb +79 -0
- data/tests/api/library_test.rb +48 -0
- data/tests/cimi/features/step_definitions/common_steps.rb +2 -2
- data/tests/cimi/features/step_definitions/machines_steps.rb +5 -4
- data/tests/cimi/features/step_definitions/volumes_steps.rb +8 -8
- data/tests/cimi/features/support/env.rb +33 -11
- data/tests/common.rb +7 -8
- data/tests/drivers/ec2/api_test.rb +19 -0
- data/tests/drivers/ec2/common.rb +23 -0
- data/tests/drivers/ec2/drivers_test.rb +120 -0
- data/tests/drivers/ec2/hardware_profiles_test.rb +224 -0
- data/tests/drivers/ec2/images_test.rb +230 -0
- data/tests/drivers/ec2/instances_test.rb +356 -0
- data/tests/drivers/ec2/keys_test.rb +181 -0
- data/tests/drivers/ec2/realms_test.rb +146 -0
- data/tests/drivers/fgcp/api_test.rb +47 -0
- data/tests/drivers/fgcp/hardware_profiles_test.rb +54 -0
- data/tests/drivers/fgcp/realms_test.rb +42 -0
- data/tests/drivers/{rackspace → fgcp}/setup.rb +5 -6
- data/tests/drivers/google/api_test.rb +10 -26
- data/tests/drivers/google/buckets_test.rb +79 -95
- data/tests/drivers/google/common.rb +54 -0
- data/tests/drivers/mock/api_test.rb +4 -127
- data/tests/drivers/mock/buckets_test.rb +195 -0
- data/tests/drivers/mock/common.rb +7 -0
- data/tests/drivers/mock/drivers_test.rb +123 -0
- data/tests/drivers/mock/hardware_profiles_test.rb +190 -100
- data/tests/drivers/mock/images_test.rb +162 -103
- data/tests/drivers/mock/instances_test.rb +310 -220
- data/tests/drivers/mock/keys_test.rb +161 -0
- data/tests/drivers/mock/realms_test.rb +109 -70
- data/tests/drivers/mock/storage_snapshots_test.rb +114 -0
- data/tests/drivers/mock/storage_volumes_test.rb +122 -0
- data/tests/drivers/openstack/api_test.rb +8 -3
- data/tests/drivers/openstack/common.rb +21 -0
- data/tests/drivers/openstack/hardware_profiles_test.rb +20 -9
- data/tests/drivers/openstack/images_test.rb +11 -5
- data/tests/drivers/openstack/instances_test.rb +61 -16
- data/tests/drivers/openstack/realms_test.rb +11 -7
- data/tests/drivers/rackspace/api_test.rb +7 -2
- data/tests/drivers/rackspace/buckets_test.rb +7 -2
- data/tests/drivers/rackspace/common.rb +16 -0
- data/tests/drivers/rackspace/hardware_profiles_test.rb +7 -2
- data/tests/drivers/rackspace/images_test.rb +7 -2
- data/tests/drivers/rackspace/instances_test.rb +10 -5
- data/tests/drivers/rackspace/realms_test.rb +7 -2
- data/tests/drivers/rhevm/api_test.rb +12 -6
- data/tests/drivers/rhevm/{setup.rb → common.rb} +8 -1
- data/tests/drivers/rhevm/hardware_profiles_test.rb +7 -2
- data/tests/drivers/rhevm/images_test.rb +8 -2
- data/tests/drivers/rhevm/instances_test.rb +7 -2
- data/tests/drivers/rhevm/realms_test.rb +7 -2
- data/tests/minitest_common.rb +58 -0
- data/tests/minitest_common_api_test.rb +115 -0
- data/views/addresses/associate.html.haml +1 -1
- data/views/addresses/index.html.haml +1 -1
- data/views/addresses/show.html.haml +2 -3
- data/views/api/show.html.haml +22 -9
- data/views/api/show.xml.haml +8 -7
- data/views/blobs/show.xml.haml +7 -4
- data/views/buckets/new.html.haml +2 -2
- data/views/cimi/errors/401.xml.haml +1 -1
- data/views/error.html.haml +3 -3
- data/views/errors/400.html.haml +1 -1
- data/views/errors/400.xml.haml +1 -2
- data/views/errors/401.html.haml +8 -7
- data/views/errors/401.xml.haml +1 -1
- data/views/errors/404.xml.haml +1 -0
- data/views/errors/500.xml.haml +4 -2
- data/views/{cimi/errors/403.html.haml → errors/501.html.haml} +4 -2
- data/views/errors/501.xml.haml +1 -0
- data/views/errors/502.xml.haml +1 -7
- data/views/{cimi/errors/500.html.haml → errors/504.html.haml} +0 -0
- data/views/errors/504.xml.haml +1 -0
- data/views/firewalls/new.html.haml +2 -2
- data/views/firewalls/new_rule.html.haml +1 -1
- data/views/firewalls/show.html.haml +1 -1
- data/views/hardware_profiles/index.html.haml +3 -1
- data/views/hardware_profiles/index.xml.haml +2 -2
- data/views/hardware_profiles/show.html.haml +3 -3
- data/views/hardware_profiles/show.xml.haml +3 -3
- data/views/images/show.html.haml +5 -0
- data/views/images/show.xml.haml +6 -1
- data/views/instance_states/show.html.haml +1 -1
- data/views/instances/index.html.haml +1 -1
- data/views/instances/new.html.haml +54 -39
- data/views/instances/run_command.html.haml +24 -15
- data/views/instances/show.html.haml +7 -3
- data/views/instances/show.xml.haml +2 -2
- data/views/keys/show.xml.haml +1 -0
- data/views/layout.html.haml +5 -9
- data/views/load_balancers/show.html.haml +12 -6
- data/views/metrics/index.html.haml +13 -0
- data/views/metrics/index.xml.haml +5 -0
- data/views/metrics/show.html.haml +23 -0
- data/views/metrics/show.xml.haml +9 -0
- data/views/realms/show.xml.haml +2 -1
- data/views/root/index.html.haml +1 -1
- data/views/storage_snapshots/show.html.haml +1 -1
- data/views/storage_snapshots/show.xml.haml +1 -0
- data/views/storage_volumes/attach.html.haml +1 -2
- data/views/storage_volumes/index.html.haml +1 -1
- data/views/storage_volumes/new.html.haml +22 -16
- data/views/storage_volumes/show.html.haml +10 -4
- data/views/storage_volumes/show.xml.haml +3 -4
- metadata +547 -519
- data/DISCLAIMER +0 -8
- data/lib/cimi/model.rb +0 -52
- data/lib/cimi/model/network.rb +0 -69
- data/lib/deltacloud/base_driver.rb +0 -18
- data/lib/deltacloud/base_driver/features.rb +0 -262
- data/lib/deltacloud/base_driver/mock_driver.rb +0 -78
- data/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb +0 -186
- data/lib/deltacloud/drivers/rhevm/rhevm_client.rb +0 -521
- data/lib/deltacloud/helpers/application_helper.rb +0 -267
- data/lib/deltacloud/helpers/hardware_profiles_helper.rb +0 -50
- data/lib/deltacloud/helpers/json_helper.rb +0 -31
- data/lib/deltacloud/method_serializer.rb +0 -83
- data/lib/deltacloud/validation.rb +0 -107
- data/lib/sinatra/rabbit.rb +0 -441
- data/lib/sinatra/rack_runtime.rb +0 -47
- data/lib/sinatra/rack_syslog.rb +0 -86
- data/lib/sinatra/sinatra_verbose.rb +0 -73
- data/lib/sinatra/static_assets.rb +0 -99
- data/public/javascripts/jquery.mobile-1.0rc1.min.js +0 -170
- data/public/stylesheets/jquery.mobile-1.0rc1.min.css +0 -12
- data/tests/drivers/google/setup.rb +0 -38
- data/tests/drivers/mock/instance_states_test.rb +0 -71
- data/tests/drivers/mock/setup.rb +0 -3
- data/tests/drivers/mock/url_for_test.rb +0 -67
- data/tests/drivers/openstack/setup.rb +0 -20
- data/views/cimi/errors/400.html.haml +0 -41
- data/views/cimi/errors/401.html.haml +0 -41
- data/views/cimi/errors/404.html.haml +0 -29
- data/views/cimi/errors/405.html.haml +0 -29
- data/views/cimi/errors/502.html.haml +0 -43
- data/views/cimi/errors/backend_capability_failure.html.haml +0 -29
@@ -0,0 +1,122 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
2
|
+
require 'tests/drivers/mock/common'
|
3
|
+
|
4
|
+
describe 'Deltacloud API storage_volumes' do
|
5
|
+
include Deltacloud::Test
|
6
|
+
|
7
|
+
it 'must advertise have the storage_volumes collection in API entrypoint' do
|
8
|
+
get root_url
|
9
|
+
(xml_response/'api/link[@rel=storage_volumes]').wont_be_empty
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'must require authentication to access the "storage_volume" collection' do
|
13
|
+
get collection_url(:storage_volumes)
|
14
|
+
last_response.status.must_equal 401
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should respond with HTTP_OK when accessing the :storage_volumes collection with authentication' do
|
18
|
+
authenticate
|
19
|
+
get collection_url(:storage_volumes)
|
20
|
+
last_response.status.must_equal 200
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should support the JSON media type' do
|
24
|
+
authenticate
|
25
|
+
header 'Accept', 'application/json'
|
26
|
+
get collection_url(:storage_volumes)
|
27
|
+
last_response.status.must_equal 200
|
28
|
+
last_response.headers['Content-Type'].must_equal 'application/json'
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'must include the ETag in HTTP headers' do
|
32
|
+
authenticate
|
33
|
+
get collection_url(:storage_volumes)
|
34
|
+
last_response.headers['ETag'].wont_be_nil
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'must have the "storage_volumes" element on top level' do
|
38
|
+
authenticate
|
39
|
+
get collection_url(:storage_volumes)
|
40
|
+
xml_response.root.name.must_equal 'storage_volumes'
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'must have some "storage_volume" elements inside "storage_volumes"' do
|
44
|
+
authenticate
|
45
|
+
get collection_url(:storage_volumes)
|
46
|
+
(xml_response/'storage_volumes/storage_volume').wont_be_empty
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'must provide the :id attribute for each storage_volume in collection' do
|
50
|
+
authenticate
|
51
|
+
get collection_url(:storage_volumes)
|
52
|
+
(xml_response/'storage_volumes/storage_volume').each do |r|
|
53
|
+
r[:id].wont_be_nil
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'must include the :href attribute for each "storage_volume" element in collection' do
|
58
|
+
authenticate
|
59
|
+
get collection_url(:storage_volumes)
|
60
|
+
(xml_response/'storage_volumes/storage_volume').each do |r|
|
61
|
+
r[:href].wont_be_nil
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'must use the absolute URL in each :href attribute' do
|
66
|
+
authenticate
|
67
|
+
get collection_url(:storage_volumes)
|
68
|
+
(xml_response/'storage_volumes/storage_volume').each do |r|
|
69
|
+
r[:href].must_match /^http/
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'must have the URL ending with the :id of the storage_volume' do
|
74
|
+
authenticate
|
75
|
+
get collection_url(:storage_volumes)
|
76
|
+
(xml_response/'storage_volumes/storage_volume').each do |r|
|
77
|
+
r[:href].must_match /#{r[:id]}$/
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'must return the list of valid parameters for the :index action' do
|
82
|
+
authenticate
|
83
|
+
options collection_url(:storage_volumes) + '/index'
|
84
|
+
last_response.headers['Allow'].wont_be_nil
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'must have the "name" element defined for each storage_volume in collection' do
|
88
|
+
authenticate
|
89
|
+
get collection_url(:storage_volumes)
|
90
|
+
(xml_response/'storage_volumes/storage_volume').each do |r|
|
91
|
+
(r/'name').wont_be_empty
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'must have the "state" element defined for each storage_volume in collection' do
|
96
|
+
authenticate
|
97
|
+
get collection_url(:storage_volumes)
|
98
|
+
(xml_response/'storage_volumes/storage_volume').each do |r|
|
99
|
+
(r/'state').wont_be_empty
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'must return the full "storage_volume" when following the URL in storage_volume element' do
|
104
|
+
authenticate
|
105
|
+
get collection_url(:storage_volumes)
|
106
|
+
(xml_response/'storage_volumes/storage_volume').each do |r|
|
107
|
+
get collection_url(:storage_volumes) + '/' + r[:id]
|
108
|
+
last_response.status.must_equal 200
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'must have the "name" element for the storage_volume and it should match with the one in collection' do
|
113
|
+
authenticate
|
114
|
+
get collection_url(:storage_volumes)
|
115
|
+
(xml_response/'storage_volumes/storage_volume').each do |r|
|
116
|
+
get collection_url(:storage_volumes) + '/' + r[:id]
|
117
|
+
(xml_response/'name').wont_be_empty
|
118
|
+
(xml_response/'name').first.text.must_equal((r/'name').first.text)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
2
|
-
require 'tests/common'
|
2
|
+
require 'tests/drivers/openstack/common'
|
3
3
|
|
4
4
|
module OpenstackTest
|
5
5
|
|
@@ -7,7 +7,12 @@ module OpenstackTest
|
|
7
7
|
include Rack::Test::Methods
|
8
8
|
|
9
9
|
def app
|
10
|
-
|
10
|
+
Rack::Builder.new {
|
11
|
+
map '/' do
|
12
|
+
use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
|
13
|
+
run Rack::Cascade.new([Deltacloud::API])
|
14
|
+
end
|
15
|
+
}
|
11
16
|
end
|
12
17
|
|
13
18
|
def test_01_it_returns_entry_points
|
@@ -31,7 +36,7 @@ module OpenstackTest
|
|
31
36
|
collections.include?('instance_states').should == true
|
32
37
|
collections.include?('instances').should == true
|
33
38
|
collections.include?('images').should == true
|
34
|
-
collections.include?('buckets').should == true
|
39
|
+
collections.include?('buckets').should == true # NOT YET IMPLEMENTED FOR V2 driver
|
35
40
|
collections.include?('realms').should == true
|
36
41
|
collections.include?('hardware_profiles').should == true
|
37
42
|
collections.length.should == 7
|
@@ -0,0 +1,21 @@
|
|
1
|
+
ENV['API_DRIVER'] = "openstack"
|
2
|
+
ENV['API_USER'] = 'foo@bar.com+foo@bar.com-default-tenant'
|
3
|
+
ENV['API_PASSWORD'] = 'Not_a_real_password!1'
|
4
|
+
ENV['API_PROVIDER'] = 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
|
5
|
+
|
6
|
+
load File.join(File.dirname(__FILE__), '..', '..', 'common.rb')
|
7
|
+
require 'vcr'
|
8
|
+
|
9
|
+
DeltacloudTestCommon::record!
|
10
|
+
|
11
|
+
VCR.config do |c|
|
12
|
+
c.cassette_library_dir = File.join(File.dirname(__FILE__), 'fixtures')
|
13
|
+
c.stub_with :webmock
|
14
|
+
c.default_cassette_options = { :record => :none }
|
15
|
+
end
|
16
|
+
|
17
|
+
class WebMock::Config
|
18
|
+
def net_http_connect_on_start
|
19
|
+
true
|
20
|
+
end
|
21
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
2
|
-
require 'tests/common'
|
2
|
+
require 'tests/drivers/openstack/common'
|
3
3
|
|
4
4
|
module OpenstackTest
|
5
5
|
|
@@ -7,12 +7,17 @@ module OpenstackTest
|
|
7
7
|
include Rack::Test::Methods
|
8
8
|
|
9
9
|
def app
|
10
|
-
|
10
|
+
Rack::Builder.new {
|
11
|
+
map '/' do
|
12
|
+
use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
|
13
|
+
run Rack::Cascade.new([Deltacloud::API])
|
14
|
+
end
|
15
|
+
}
|
11
16
|
end
|
12
17
|
|
13
18
|
def test_01_it_returns_hardware_profiles
|
14
19
|
get_auth_url '/api;driver=openstack/hardware_profiles'
|
15
|
-
(last_xml_response/'hardware_profiles/hardware_profile').length.should
|
20
|
+
(last_xml_response/'hardware_profiles/hardware_profile').length.should > 0
|
16
21
|
end
|
17
22
|
|
18
23
|
def test_02_each_hardware_profile_has_a_name
|
@@ -32,21 +37,27 @@ module OpenstackTest
|
|
32
37
|
(profile/'property[@name="storage"]').first[:unit].should == 'GB'
|
33
38
|
(profile/'property[@name="storage"]').first[:kind].should == 'fixed'
|
34
39
|
end
|
40
|
+
hwp = ((last_xml_response/'hardware_profiles/hardware_profile').first)
|
41
|
+
@@hwp = { :id => hwp[:id],
|
42
|
+
:arch => (hwp/'property[@name="architecture"]').first[:value],
|
43
|
+
:mem => (hwp/'property[@name="memory"]').first[:value],
|
44
|
+
:disk => (hwp/'property[@name="storage"]').first[:value] }
|
45
|
+
@@no_of_profiles = (last_xml_response/'hardware_profiles/hardware_profile').length
|
35
46
|
end
|
36
47
|
|
37
48
|
def test_04_it_returns_single_hardware_profile
|
38
|
-
get_auth_url
|
39
|
-
(last_xml_response/'hardware_profile/name').first.text.should ==
|
40
|
-
(last_xml_response/'hardware_profile/property[@name="architecture"]').first[:value].should ==
|
41
|
-
(last_xml_response/'hardware_profile/property[@name="memory"]').first[:value].should ==
|
42
|
-
(last_xml_response/'hardware_profile/property[@name="storage"]').first[:value].should ==
|
49
|
+
get_auth_url "/api;driver=openstack/hardware_profiles/#{@@hwp[:id]}"
|
50
|
+
(last_xml_response/'hardware_profile/name').first.text.should == @@hwp[:id]
|
51
|
+
(last_xml_response/'hardware_profile/property[@name="architecture"]').first[:value].should == @@hwp[:arch]
|
52
|
+
(last_xml_response/'hardware_profile/property[@name="memory"]').first[:value].should == @@hwp[:mem]
|
53
|
+
(last_xml_response/'hardware_profile/property[@name="storage"]').first[:value].should == @@hwp[:disk]
|
43
54
|
end
|
44
55
|
|
45
56
|
def test_05_it_filter_hardware_profiles
|
46
57
|
get_auth_url '/api;driver=openstack/hardware_profiles?architecture=i386'
|
47
58
|
(last_xml_response/'hardware_profiles/hardware_profile').length.should == 0
|
48
59
|
get_auth_url '/api;driver=openstack/hardware_profiles?architecture=x86_64'
|
49
|
-
(last_xml_response/'hardware_profiles/hardware_profile').length.should ==
|
60
|
+
(last_xml_response/'hardware_profiles/hardware_profile').length.should == @@no_of_profiles
|
50
61
|
end
|
51
62
|
|
52
63
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
2
|
-
require 'tests/common'
|
2
|
+
require 'tests/drivers/openstack/common'
|
3
3
|
|
4
4
|
module OpenstackTest
|
5
5
|
|
@@ -7,7 +7,12 @@ module OpenstackTest
|
|
7
7
|
include Rack::Test::Methods
|
8
8
|
|
9
9
|
def app
|
10
|
-
|
10
|
+
Rack::Builder.new {
|
11
|
+
map '/' do
|
12
|
+
use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
|
13
|
+
run Rack::Cascade.new([Deltacloud::API])
|
14
|
+
end
|
15
|
+
}
|
11
16
|
end
|
12
17
|
|
13
18
|
def test_01_it_returns_images
|
@@ -25,14 +30,15 @@ module OpenstackTest
|
|
25
30
|
(image/'architecture').should_not == nil
|
26
31
|
(image/'architecture').should_not == ''
|
27
32
|
(image/'state').text.should == 'ACTIVE'
|
28
|
-
(image/'owner_id').text.should ==
|
29
|
-
(image/'actions/link').length.should ==
|
33
|
+
ENV['API_USER'].include?((image/'owner_id').text).should == true
|
34
|
+
(image/'actions/link').length.should == 2
|
30
35
|
(image/'actions/link').first[:rel].should == 'create_instance'
|
31
36
|
end
|
37
|
+
@@image_id = ((last_xml_response/'images/image').first)[:id]
|
32
38
|
end
|
33
39
|
|
34
40
|
def test_03_it_returns_single_image
|
35
|
-
get_auth_url
|
41
|
+
get_auth_url "/api;driver=openstack/images/#{@@image_id}"
|
36
42
|
(last_xml_response/'image').length.should == 1
|
37
43
|
end
|
38
44
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
2
|
-
require 'tests/common'
|
2
|
+
require 'tests/drivers/openstack/common'
|
3
3
|
|
4
4
|
module OpenstackTest
|
5
5
|
|
@@ -7,39 +7,52 @@ module OpenstackTest
|
|
7
7
|
include Rack::Test::Methods
|
8
8
|
|
9
9
|
def app
|
10
|
-
|
10
|
+
Rack::Builder.new {
|
11
|
+
map '/' do
|
12
|
+
use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
|
13
|
+
run Rack::Cascade.new([Deltacloud::API])
|
14
|
+
end
|
15
|
+
}
|
11
16
|
end
|
12
17
|
|
13
18
|
def test_01_01_it_can_create_instance_without_hardware_profile
|
19
|
+
get_auth_url '/api;driver=openstack/images'
|
20
|
+
@@image_id = ((last_xml_response/'images/image').first)[:id]
|
14
21
|
params = {
|
15
|
-
:image_id =>
|
22
|
+
:image_id => @@image_id,
|
16
23
|
:'api[driver]' => 'openstack',
|
17
24
|
}
|
18
|
-
|
25
|
+
uri = '/api/instances'
|
26
|
+
vcr_cassette = stable_vcr_cassette_name('post', uri, params)
|
27
|
+
post_url uri, params, {'vcr_cassette'=>vcr_cassette}
|
19
28
|
last_response.status.should == 201 # Created
|
20
29
|
@@instance = last_xml_response
|
21
30
|
(@@instance/'instance').length.should > 0
|
22
31
|
(@@instance/'instance/name').first.text.should_not == nil
|
23
32
|
(@@instance/'instance/name').first.text.should_not == nil
|
24
33
|
(@@instance/'instance/owner_id').first.text.should_not == ''
|
25
|
-
(@@instance/'instance/owner_id').first.text.should ==
|
34
|
+
ENV['API_USER'].include?((@@instance/'instance/owner_id').first.text).should == true
|
26
35
|
(@@instance/'instance/state').first.text.should == 'PENDING'
|
27
36
|
end
|
28
37
|
|
29
38
|
def test_01_02_it_can_create_instance_with_hardware_profile
|
39
|
+
get_auth_url '/api;driver=openstack/hardware_profiles'
|
40
|
+
@@hwp_id = ((last_xml_response/'hardware_profiles/hardware_profile').first)[:id]
|
30
41
|
params = {
|
31
|
-
:image_id =>
|
32
|
-
:hwp_id =>
|
42
|
+
:image_id => @@image_id,
|
43
|
+
:hwp_id => @@hwp_id,
|
33
44
|
:'api[driver]' => 'openstack',
|
34
45
|
}
|
35
|
-
|
46
|
+
uri = '/api/instances'
|
47
|
+
vcr_cassette = stable_vcr_cassette_name('post', uri, params)
|
48
|
+
post_url uri, params, {'vcr_cassette'=>vcr_cassette}
|
36
49
|
last_response.status.should == 201 # Created
|
37
50
|
@@instance2 = last_xml_response
|
38
51
|
(@@instance2/'instance').length.should > 0
|
39
52
|
(@@instance2/'instance/name').first.text.should_not == nil
|
40
53
|
(@@instance2/'instance/name').first.text.should_not == nil
|
41
54
|
(@@instance2/'instance/owner_id').first.text.should_not == ''
|
42
|
-
(@@instance2/'instance/owner_id').first.text.should ==
|
55
|
+
ENV['API_USER'].include?((@@instance2/'instance/owner_id').first.text).should == true
|
43
56
|
(@@instance2/'instance/state').first.text.should == 'PENDING'
|
44
57
|
end
|
45
58
|
|
@@ -58,6 +71,7 @@ module OpenstackTest
|
|
58
71
|
(@@instance2/'instance/authentication/login/password').first.text.should_not == nil
|
59
72
|
(@@instance2/'instance/authentication/login/password').first.text.should_not == ''
|
60
73
|
end
|
74
|
+
|
61
75
|
=begin
|
62
76
|
TODO: Disabled since our testing setup doesn't return IP addresses yet ;-)
|
63
77
|
def test_03_01_created_instance_has_correct_addresses
|
@@ -75,7 +89,7 @@ module OpenstackTest
|
|
75
89
|
|
76
90
|
def test_03_02_created_instance_has_correct_hardware_profile
|
77
91
|
(@@instance2/'instance/hardware_profile').length.should == 1
|
78
|
-
(@@instance2/'instance/hardware_profile').first[:id].should ==
|
92
|
+
(@@instance2/'instance/hardware_profile').first[:id].should == @@hwp_id
|
79
93
|
(@@instance2/'instance/hardware_profile').first[:href].should_not == nil
|
80
94
|
end
|
81
95
|
|
@@ -94,7 +108,6 @@ module OpenstackTest
|
|
94
108
|
(last_xml_response/'instance/actions/link[@rel="reboot"]').first.should_not == nil
|
95
109
|
(last_xml_response/'instance/actions/link[@rel="stop"]').first.should_not == nil
|
96
110
|
(last_xml_response/'instance/actions/link[@rel="create_image"]').first.should_not == nil
|
97
|
-
(last_xml_response/'instance/actions/link[@rel="run"]').first.should_not == nil
|
98
111
|
end
|
99
112
|
|
100
113
|
def test_04_02_created_instance_goes_to_running_state
|
@@ -112,7 +125,6 @@ module OpenstackTest
|
|
112
125
|
(last_xml_response/'instance/actions/link[@rel="reboot"]').first.should_not == nil
|
113
126
|
(last_xml_response/'instance/actions/link[@rel="stop"]').first.should_not == nil
|
114
127
|
(last_xml_response/'instance/actions/link[@rel="create_image"]').first.should_not == nil
|
115
|
-
(last_xml_response/'instance/actions/link[@rel="run"]').first.should_not == nil
|
116
128
|
end
|
117
129
|
|
118
130
|
def test_05_01_created_instance_can_be_rebooted
|
@@ -120,7 +132,7 @@ module OpenstackTest
|
|
120
132
|
:'api[driver]' => 'openstack',
|
121
133
|
}
|
122
134
|
post_url "/api/instances/#{(@@instance/'instance').first[:id]}/reboot", params
|
123
|
-
last_response.status.should ==
|
135
|
+
last_response.status.should == 202
|
124
136
|
20.times do |tick|
|
125
137
|
get_auth_url "/api;driver=openstack/instances/#{(@@instance/'instance').first[:id]}", { :tick => tick}
|
126
138
|
last_response.status.should_not == 500
|
@@ -130,12 +142,36 @@ module OpenstackTest
|
|
130
142
|
end
|
131
143
|
end
|
132
144
|
|
145
|
+
def test_05_02_created_instance_can_be_rebooted
|
146
|
+
params = {
|
147
|
+
:'api[driver]' => 'openstack',
|
148
|
+
}
|
149
|
+
post_url "/api/instances/#{(@@instance2/'instance').first[:id]}/reboot", params
|
150
|
+
last_response.status.should == 202
|
151
|
+
20.times do |tick|
|
152
|
+
get_auth_url "/api;driver=openstack/instances/#{(@@instance2/'instance').first[:id]}", { :tick => tick}
|
153
|
+
last_response.status.should_not == 500
|
154
|
+
state = (last_xml_response/'instance/state').first.text
|
155
|
+
break if state=='RUNNING'
|
156
|
+
sleep(5)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
133
160
|
def test_06_01_created_instance_can_be_destroyed
|
161
|
+
#first make sure we recovered from the reboot
|
162
|
+
20.times do |tick|
|
163
|
+
get_auth_url "/api;driver=openstack/instances/#{(@@instance/'instance').first[:id]}", { :tick => tick}
|
164
|
+
last_response.status.should_not == 500
|
165
|
+
state = (last_xml_response/'instance/state').first.text
|
166
|
+
break if state=='RUNNING'
|
167
|
+
sleep(5)
|
168
|
+
end
|
169
|
+
#now destroy
|
134
170
|
params = {
|
135
171
|
:'api[driver]' => 'openstack',
|
136
172
|
}
|
137
173
|
post_url "/api/instances/#{(@@instance/'instance').first[:id]}/stop", params
|
138
|
-
last_response.status.should ==
|
174
|
+
last_response.status.should == 202
|
139
175
|
20.times do |tick|
|
140
176
|
get_auth_url "/api;driver=openstack/instances/#{(@@instance/'instance').first[:id]}", { :tick => tick}
|
141
177
|
last_response.status.should_not == 500
|
@@ -146,11 +182,20 @@ module OpenstackTest
|
|
146
182
|
end
|
147
183
|
|
148
184
|
def test_06_02_created_instance_can_be_destroyed
|
185
|
+
#first make sure we recovered from the reboot
|
186
|
+
20.times do |tick|
|
187
|
+
get_auth_url "/api;driver=openstack/instances/#{(@@instance2/'instance').first[:id]}", { :tick => tick}
|
188
|
+
last_response.status.should_not == 500
|
189
|
+
state = (last_xml_response/'instance/state').first.text
|
190
|
+
break if state=='RUNNING'
|
191
|
+
sleep(5)
|
192
|
+
end
|
193
|
+
#now destroy
|
149
194
|
params = {
|
150
195
|
:'api[driver]' => 'openstack',
|
151
196
|
}
|
152
|
-
post_url "/api/instances/#{(@@instance2/'instance').first[:id]}/stop", params
|
153
|
-
last_response.status.should ==
|
197
|
+
post_url "/api/instances/#{(@@instance2/'instance').first[:id]}/stop", params
|
198
|
+
last_response.status.should == 202
|
154
199
|
20.times do |tick|
|
155
200
|
get_auth_url "/api;driver=openstack/instances/#{(@@instance2/'instance').first[:id]}", { :tick => tick}
|
156
201
|
last_response.status.should_not == 500
|
@@ -1,5 +1,5 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
2
|
-
require 'tests/common'
|
2
|
+
require 'tests/drivers/openstack/common'
|
3
3
|
|
4
4
|
module OpenstackTest
|
5
5
|
|
@@ -7,12 +7,17 @@ module OpenstackTest
|
|
7
7
|
include Rack::Test::Methods
|
8
8
|
|
9
9
|
def app
|
10
|
-
|
10
|
+
Rack::Builder.new {
|
11
|
+
map '/' do
|
12
|
+
use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
|
13
|
+
run Rack::Cascade.new([Deltacloud::API])
|
14
|
+
end
|
15
|
+
}
|
11
16
|
end
|
12
17
|
|
13
18
|
def test_01_it_returns_realms
|
14
19
|
get_auth_url '/api;driver=openstack/realms'
|
15
|
-
(last_xml_response/'realms/realm').length.should
|
20
|
+
(last_xml_response/'realms/realm').length.should > 0
|
16
21
|
end
|
17
22
|
|
18
23
|
def test_02_each_realm_has_a_name
|
@@ -20,16 +25,15 @@ module OpenstackTest
|
|
20
25
|
(last_xml_response/'realms/realm').each do |profile|
|
21
26
|
(profile/'name').text.should_not == nil
|
22
27
|
(profile/'name').text.should_not == ''
|
23
|
-
(profile/'name').text.should == '
|
28
|
+
(profile/'name').text.should == 'default'
|
24
29
|
end
|
25
30
|
end
|
26
31
|
|
27
32
|
def test_03_it_returns_single_realm
|
28
33
|
get_auth_url '/api;driver=openstack/realms/us'
|
29
|
-
(last_xml_response/'realm').first[:id].should == '
|
30
|
-
(last_xml_response/'realm/name').first.text.should == '
|
34
|
+
(last_xml_response/'realm').first[:id].should == 'default'
|
35
|
+
(last_xml_response/'realm/name').first.text.should == 'default'
|
31
36
|
(last_xml_response/'realm/state').first.text.should == 'AVAILABLE'
|
32
|
-
(last_xml_response/'realm/limit').first.text.should == ''
|
33
37
|
end
|
34
38
|
|
35
39
|
end
|