deltacloud-core 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/bin/deltacloudd +11 -5
- data/config.ru +3 -3
- data/deltacloud-core.gemspec +24 -18
- data/lib/cimi/collections/address_templates.rb +3 -3
- data/lib/cimi/collections/addresses.rb +6 -5
- data/lib/cimi/collections/entity_metadata.rb +0 -2
- data/lib/cimi/collections/machine_admins.rb +5 -5
- data/lib/cimi/collections/machine_configurations.rb +2 -2
- data/lib/cimi/collections/machine_images.rb +3 -3
- data/lib/cimi/collections/machines.rb +32 -10
- data/lib/cimi/collections/network_configurations.rb +4 -3
- data/lib/cimi/collections/network_templates.rb +4 -3
- data/lib/cimi/collections/networks.rb +8 -8
- data/lib/cimi/collections/routing_group_templates.rb +4 -3
- data/lib/cimi/collections/routing_groups.rb +4 -3
- data/lib/cimi/collections/volume_configurations.rb +3 -3
- data/lib/cimi/collections/volume_images.rb +3 -3
- data/lib/cimi/collections/volumes.rb +4 -3
- data/lib/cimi/collections/vsp_configurations.rb +4 -3
- data/lib/cimi/collections/vsp_templates.rb +4 -3
- data/lib/cimi/collections/vsps.rb +8 -7
- data/lib/cimi/helpers.rb +1 -1
- data/lib/cimi/helpers/cimi_helper.rb +11 -1
- data/lib/cimi/models.rb +4 -0
- data/lib/cimi/models/base.rb +11 -1
- data/lib/cimi/models/cloud_entry_point.rb +7 -14
- data/lib/cimi/models/disk.rb +40 -0
- data/lib/cimi/models/disk_collection.rb +38 -0
- data/lib/cimi/models/machine.rb +9 -43
- data/lib/cimi/models/machine_collection.rb +7 -4
- data/lib/cimi/models/machine_configuration.rb +8 -15
- data/lib/cimi/models/machine_configuration_collection.rb +6 -4
- data/lib/cimi/models/machine_image_collection.rb +6 -4
- data/lib/cimi/models/machine_template_collection.rb +6 -4
- data/lib/cimi/models/machine_volume.rb +42 -0
- data/lib/cimi/models/machine_volume_collection.rb +34 -0
- data/lib/cimi/models/network.rb +5 -9
- data/lib/cimi/models/network_collection.rb +6 -5
- data/lib/cimi/models/schema.rb +20 -0
- data/lib/cimi/models/volume_collection.rb +6 -4
- data/lib/cimi/models/volume_configuration_collection.rb +6 -4
- data/lib/cimi/models/volume_image_collection.rb +6 -4
- data/lib/cimi/models/volume_template_collection.rb +6 -4
- data/lib/deltacloud/api.rb +3 -3
- data/lib/deltacloud/collections/addresses.rb +1 -1
- data/lib/deltacloud/collections/firewalls.rb +4 -2
- data/lib/deltacloud/collections/keys.rb +1 -1
- data/lib/deltacloud/collections/load_balancers.rb +1 -1
- data/lib/deltacloud/collections/storage_volumes.rb +4 -4
- data/lib/deltacloud/drivers/base_driver.rb +12 -20
- data/lib/deltacloud/drivers/ec2/aws_vpc_monkey_patch.rb +294 -0
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +38 -6
- data/lib/deltacloud/drivers/fgcp/fgcp_client.rb +4 -0
- data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +40 -4
- data/lib/deltacloud/drivers/gogrid/gogrid_client.rb +8 -7
- data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +422 -416
- data/lib/deltacloud/drivers/google/google_driver.rb +2 -1
- data/lib/deltacloud/drivers/openstack/openstack_driver.rb +30 -16
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +1 -0
- data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +3 -9
- data/lib/deltacloud/helpers/deltacloud_helper.rb +0 -2
- data/lib/deltacloud/models/firewall_rule.rb +2 -0
- data/lib/deltacloud/models/hardware_profile.rb +61 -59
- data/{tests/deprecated/core_ext/string.rb → lib/deltacloud/version.rb} +3 -15
- data/lib/deltacloud_rack.rb +1 -0
- data/lib/ec2/server.rb +5 -3
- data/lib/sinatra/rack_accept.rb +53 -53
- data/lib/sinatra/rack_etag.rb +1 -1
- data/tests/cimi/collections/cloud_entry_point_test.rb +11 -2
- data/tests/deltacloud/common.rb +1 -1
- data/tests/deltacloud/rack_test.rb +3 -3
- data/tests/drivers/base/base_driver_test.rb +6 -2
- data/tests/drivers/base/common.rb +1 -0
- data/tests/drivers/base/library_test.rb +6 -2
- data/tests/drivers/ec2/common.rb +34 -15
- data/tests/drivers/ec2/images_test.rb +2 -3
- data/tests/drivers/ec2/instance_test.rb +12 -2
- data/tests/drivers/ec2/keys_test.rb +2 -2
- data/tests/drivers/ec2/realms_test.rb +7 -3
- data/tests/drivers/ec2/storage_snapshots_test.rb +2 -3
- data/tests/drivers/gogrid/common.rb +24 -0
- data/tests/drivers/gogrid/hardware_profiles_test.rb +51 -0
- data/tests/drivers/gogrid/images_test.rb +57 -0
- data/tests/drivers/gogrid/instances_test.rb +92 -0
- data/tests/drivers/gogrid/realms_test.rb +45 -0
- data/tests/drivers/google/buckets_test.rb +105 -0
- data/tests/drivers/google/common.rb +20 -0
- data/tests/drivers/mock/common.rb +1 -0
- data/tests/drivers/mock/images_test.rb +3 -2
- data/tests/drivers/mock/instances_test.rb +3 -2
- data/tests/drivers/mock/keys_test.rb +3 -2
- data/tests/drivers/mock/realms_test.rb +3 -2
- data/tests/drivers/mock/storage_snapshots_test.rb +3 -2
- data/tests/drivers/mock/storage_volumes_test.rb +3 -2
- data/tests/drivers/models/address_test.rb +3 -3
- data/tests/drivers/models/base_test.rb +4 -2
- data/tests/drivers/models/blob_test.rb +3 -3
- data/tests/drivers/models/common.rb +3 -0
- data/tests/drivers/models/hardware_profile_test.rb +5 -4
- data/tests/drivers/models/instance_address_test.rb +3 -3
- data/tests/drivers/models/instance_profile_test.rb +3 -3
- data/tests/drivers/models/instance_test.rb +3 -3
- data/tests/drivers/models/keys_test.rb +3 -3
- data/tests/drivers/models/metrics_test.rb +3 -3
- data/tests/drivers/openstack/common.rb +26 -0
- data/tests/drivers/openstack/hardware_profiles_test.rb +46 -0
- data/tests/drivers/openstack/images_test.rb +50 -0
- data/tests/drivers/openstack/instances_test.rb +66 -0
- data/tests/drivers/openstack/keys_test.rb +61 -0
- data/tests/drivers/openstack/realms_test.rb +46 -0
- data/tests/drivers/rhevm/common.rb +2 -0
- data/tests/drivers/rhevm/images_test.rb +3 -4
- data/tests/drivers/rhevm/instance_test.rb +2 -2
- data/tests/drivers/rhevm/provider_test.rb +2 -2
- data/tests/drivers/rhevm/realms_test.rb +2 -3
- data/tests/ec2/common.rb +5 -4
- data/tests/ec2/server_test.rb +3 -2
- data/tests/helpers/rack/common.rb +3 -0
- data/tests/helpers/rack/rack_accept_test.rb +65 -0
- data/tests/helpers/rack/rack_date_test.rb +27 -0
- data/tests/helpers/rack/rack_driver_select_test.rb +53 -0
- data/tests/helpers/rack/rack_etag_test.rb +29 -0
- data/tests/helpers/rack/rack_matrix_params_test.rb +72 -0
- data/tests/test_helper.rb +44 -36
- data/views/hardware_profiles/index.html.haml +1 -1
- data/views/hardware_profiles/show.html.haml +2 -2
- data/views/hardware_profiles/show.xml.haml +2 -1
- data/views/images/show.html.haml +6 -5
- metadata +74 -117
- data/tests/deprecated/api/common.rb +0 -1
- data/tests/deprecated/api/driver_test.rb +0 -79
- data/tests/deprecated/api/library_test.rb +0 -6
- data/tests/deprecated/cimi/features/step_definitions/common_steps.rb +0 -59
- data/tests/deprecated/cimi/features/step_definitions/machine_images_steps.rb +0 -0
- data/tests/deprecated/cimi/features/step_definitions/machines_steps.rb +0 -100
- data/tests/deprecated/cimi/features/step_definitions/volumes_steps.rb +0 -115
- data/tests/deprecated/cimi/features/support/env.rb +0 -75
- data/tests/deprecated/common.rb +0 -279
- data/tests/deprecated/drivers/ec2/api_test.rb +0 -19
- data/tests/deprecated/drivers/ec2/common.rb +0 -23
- data/tests/deprecated/drivers/ec2/drivers_test.rb +0 -120
- data/tests/deprecated/drivers/ec2/hardware_profiles_test.rb +0 -224
- data/tests/deprecated/drivers/ec2/images_test.rb +0 -230
- data/tests/deprecated/drivers/ec2/instances_test.rb +0 -356
- data/tests/deprecated/drivers/ec2/keys_test.rb +0 -181
- data/tests/deprecated/drivers/ec2/realms_test.rb +0 -146
- data/tests/deprecated/drivers/fgcp/api_test.rb +0 -47
- data/tests/deprecated/drivers/fgcp/hardware_profiles_test.rb +0 -54
- data/tests/deprecated/drivers/fgcp/realms_test.rb +0 -42
- data/tests/deprecated/drivers/fgcp/setup.rb +0 -13
- data/tests/deprecated/drivers/google/api_test.rb +0 -19
- data/tests/deprecated/drivers/google/buckets_test.rb +0 -100
- data/tests/deprecated/drivers/google/common.rb +0 -54
- data/tests/deprecated/drivers/mock/api_test.rb +0 -10
- data/tests/deprecated/drivers/mock/buckets_test.rb +0 -195
- data/tests/deprecated/drivers/mock/common.rb +0 -7
- data/tests/deprecated/drivers/mock/drivers_test.rb +0 -123
- data/tests/deprecated/drivers/mock/hardware_profiles_test.rb +0 -224
- data/tests/deprecated/drivers/mock/images_test.rb +0 -197
- data/tests/deprecated/drivers/mock/instances_test.rb +0 -343
- data/tests/deprecated/drivers/mock/keys_test.rb +0 -161
- data/tests/deprecated/drivers/mock/realms_test.rb +0 -132
- data/tests/deprecated/drivers/mock/storage_snapshots_test.rb +0 -114
- data/tests/deprecated/drivers/mock/storage_volumes_test.rb +0 -122
- data/tests/deprecated/drivers/openstack/api_test.rb +0 -46
- data/tests/deprecated/drivers/openstack/common.rb +0 -21
- data/tests/deprecated/drivers/openstack/hardware_profiles_test.rb +0 -64
- data/tests/deprecated/drivers/openstack/images_test.rb +0 -46
- data/tests/deprecated/drivers/openstack/instances_test.rb +0 -208
- data/tests/deprecated/drivers/openstack/realms_test.rb +0 -40
- data/tests/deprecated/drivers/rackspace/api_test.rb +0 -46
- data/tests/deprecated/drivers/rackspace/buckets_test.rb +0 -150
- data/tests/deprecated/drivers/rackspace/common.rb +0 -16
- data/tests/deprecated/drivers/rackspace/hardware_profiles_test.rb +0 -58
- data/tests/deprecated/drivers/rackspace/images_test.rb +0 -45
- data/tests/deprecated/drivers/rackspace/instances_test.rb +0 -166
- data/tests/deprecated/drivers/rackspace/realms_test.rb +0 -41
- data/tests/deprecated/drivers/rhevm/api_test.rb +0 -45
- data/tests/deprecated/drivers/rhevm/common.rb +0 -21
- data/tests/deprecated/drivers/rhevm/hardware_profiles_test.rb +0 -58
- data/tests/deprecated/drivers/rhevm/images_test.rb +0 -48
- data/tests/deprecated/drivers/rhevm/instances_test.rb +0 -182
- data/tests/deprecated/drivers/rhevm/realms_test.rb +0 -40
- data/tests/deprecated/minitest_common.rb +0 -58
- data/tests/deprecated/minitest_common_api_test.rb +0 -115
- data/tests/deprecated/rabbit_test.rb +0 -52
@@ -1,115 +0,0 @@
|
|
1
|
-
#these are common MiniTest::Spec assertions
|
2
|
-
#used across all drivers. See /drivers/*/api_test.rb
|
3
|
-
|
4
|
-
it 'return HTTP_OK when accessing API entrypoint' do
|
5
|
-
get root_url
|
6
|
-
last_response.status.must_equal 200
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'advertise the current driver in API entrypoint' do
|
10
|
-
get root_url
|
11
|
-
xml_response.root[:driver].must_equal ENV['API_DRIVER']
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'advertise the current API version in API entrypoint' do
|
15
|
-
get root_url
|
16
|
-
xml_response.root[:version].must_equal api_version
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'advertise the current API version in HTTP headers' do
|
20
|
-
get root_url
|
21
|
-
last_response.headers['Server'].must_equal "Apache-Deltacloud/#{api_version}"
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'must include the ETag in HTTP headers' do
|
25
|
-
get root_url
|
26
|
-
last_response.headers['ETag'].wont_be_nil
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'advertise collections in API entrypoint' do
|
30
|
-
get root_url
|
31
|
-
(xml_response/'api/link').wont_be_empty
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'include the :href and :rel attribute for each collection in API entrypoint' do
|
35
|
-
get root_url
|
36
|
-
(xml_response/'api/link').each do |collection|
|
37
|
-
collection[:href].wont_be_nil
|
38
|
-
collection[:rel].wont_be_nil
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'uses the absolute URI in the :href attribute for each collection in API entrypoint' do
|
43
|
-
get root_url
|
44
|
-
(xml_response/'api/link').each do |collection|
|
45
|
-
collection[:href].must_match /^http/
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'advertise features for some collections in API entrypoint' do
|
50
|
-
get root_url
|
51
|
-
(xml_response/'api/link/feature').wont_be_empty
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'advertise the name of the feature for some collections in API entrypoint' do
|
55
|
-
get root_url
|
56
|
-
(xml_response/'api/link/feature').each do |f|
|
57
|
-
f[:name].wont_be_nil
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'must change the media type from XML to JSON using Accept headers' do
|
62
|
-
header 'Accept', 'application/json'
|
63
|
-
get root_url
|
64
|
-
last_response.headers['Content-Type'].must_equal 'application/json'
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'must change the media type to JSON using the "?format" parameter in URL' do
|
68
|
-
get root_url, { :format => 'json' }
|
69
|
-
last_response.headers['Content-Type'].must_equal 'application/json'
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'must change the driver when using X-Deltacloud-Driver HTTP header' do
|
73
|
-
header 'X-Deltacloud-Driver', 'ec2'
|
74
|
-
get root_url
|
75
|
-
xml_response.root[:driver].must_equal 'ec2'
|
76
|
-
header 'X-Deltacloud-Driver', 'mock'
|
77
|
-
get root_url
|
78
|
-
xml_response.root[:driver].must_equal 'mock'
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'must change the features when driver is swapped using HTTP headers' do
|
82
|
-
header 'X-Deltacloud-Driver', 'ec2'
|
83
|
-
get root_url
|
84
|
-
# The 'user_name' feature is not supported currently for the EC2 driver
|
85
|
-
(xml_response/'api/link/feature').map { |f| f[:name] }.wont_include 'user_name'
|
86
|
-
header 'X-Deltacloud-Driver', 'mock'
|
87
|
-
get root_url
|
88
|
-
# But it's supported in Mock driver
|
89
|
-
(xml_response/'api/link/feature').map { |f| f[:name] }.must_include 'user_name'
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'must re-validate the driver credentials when using "?force_auth" parameter in URL' do
|
93
|
-
get root_url, { :force_auth => '1' }
|
94
|
-
last_response.status.must_equal 401
|
95
|
-
authenticate
|
96
|
-
get root_url, { :force_auth => '1' }
|
97
|
-
last_response.status.must_equal 200
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'must change the API PROVIDER using the /api;provider matrix parameter in URI' do
|
101
|
-
get root_url + ';provider=test1'
|
102
|
-
xml_response.root[:provider].wont_be_nil
|
103
|
-
xml_response.root[:provider].must_equal 'test1'
|
104
|
-
get root_url + ';provider=test2'
|
105
|
-
xml_response.root[:provider].must_equal 'test2'
|
106
|
-
end
|
107
|
-
|
108
|
-
it 'must change the API DRIVER using the /api;driver matrix parameter in URI' do
|
109
|
-
get root_url + ';driver=ec2'
|
110
|
-
xml_response.root[:driver].must_equal 'ec2'
|
111
|
-
get root_url + ';driver=mock'
|
112
|
-
xml_response.root[:driver].must_equal 'mock'
|
113
|
-
end
|
114
|
-
|
115
|
-
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
-
# contributor license agreements. See the NOTICE file distributed with
|
3
|
-
# this work for additional information regarding copyright ownership. The
|
4
|
-
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
-
# "License"); you may not use this file except in compliance with the
|
6
|
-
# License. You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
-
# License for the specific language governing permissions and limitations
|
14
|
-
# under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
18
|
-
require 'tests/common'
|
19
|
-
|
20
|
-
require 'deltacloud/drivers'
|
21
|
-
require 'deltacloud/drivers/mock/mock_driver'
|
22
|
-
|
23
|
-
module DeltacloudUnitTest
|
24
|
-
class ApiTest < Test::Unit::TestCase
|
25
|
-
include Rack::Test::Methods
|
26
|
-
|
27
|
-
def setup
|
28
|
-
@app ||= Sinatra::Application
|
29
|
-
@driver ||= Deltacloud::Drivers::Mock::MockDriver.new
|
30
|
-
end
|
31
|
-
|
32
|
-
def teardown
|
33
|
-
@app = nil
|
34
|
-
@driver = nil
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_params
|
38
|
-
op = @app.collections[:instances].operations[:create]
|
39
|
-
op.params.keys =~ [:realm_id, :image_id, :hwp_id]
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_effective_params
|
43
|
-
features = @driver.features(:instances).collect { |f| f.name }
|
44
|
-
features.should =~ [:hardware_profiles, :user_name, :authentication_key, :user_data]
|
45
|
-
|
46
|
-
op = @app.collections[:instances].operations[:create]
|
47
|
-
op.effective_params(@driver).keys.should =~ [:image_id, :hwp_memory, :hwp_id, :keyname, :name, :hwp_storage, :realm_id, :user_data, :hwp_architecture, :hwp_cpu]
|
48
|
-
|
49
|
-
op.params.keys =~ [:realm_id, :image_id, :hwp_id]
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|