deltacloud-core 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +40 -28
- data/bin/deltacloud-db-upgrade +24 -0
- data/bin/deltacloudd +20 -9
- data/config.ru +12 -53
- data/db/migrations/1_add_realm_to_machine_template.rb +23 -0
- data/deltacloud-core.gemspec +11 -5
- data/lib/cimi/collections.rb +4 -31
- data/lib/cimi/collections/address_templates.rb +2 -5
- data/lib/cimi/collections/addresses.rb +2 -5
- data/lib/cimi/collections/base.rb +18 -6
- data/lib/cimi/collections/credentials.rb +2 -5
- data/lib/cimi/collections/machine_images.rb +2 -1
- data/lib/cimi/collections/machine_templates.rb +2 -5
- data/lib/cimi/collections/machines.rb +6 -9
- data/lib/cimi/collections/network_ports.rb +3 -3
- data/lib/cimi/collections/networks.rb +5 -8
- data/lib/cimi/collections/system_templates.rb +72 -0
- data/lib/cimi/collections/systems.rb +194 -0
- data/lib/cimi/collections/volume_configurations.rb +1 -1
- data/lib/cimi/collections/volume_images.rb +2 -1
- data/lib/cimi/collections/volume_templates.rb +3 -2
- data/lib/cimi/collections/volumes.rb +2 -2
- data/lib/cimi/dependencies.rb +0 -2
- data/lib/cimi/helpers/cimi_helper.rb +12 -57
- data/lib/cimi/helpers/database_helper.rb +0 -4
- data/lib/cimi/models.rb +25 -14
- data/lib/cimi/models/address.rb +4 -31
- data/lib/cimi/models/address_create.rb +51 -0
- data/lib/cimi/models/address_template.rb +8 -52
- data/lib/cimi/models/address_template_create.rb +44 -0
- data/lib/cimi/models/base.rb +44 -6
- data/lib/cimi/models/cloud_entry_point.rb +1 -1
- data/lib/cimi/models/credential.rb +1 -1
- data/lib/cimi/models/credential_create.rb +46 -0
- data/lib/cimi/models/credential_template.rb +24 -0
- data/lib/cimi/models/machine.rb +1 -71
- data/lib/cimi/models/machine_configuration.rb +3 -3
- data/lib/cimi/models/machine_create.rb +49 -0
- data/lib/cimi/models/machine_image.rb +2 -25
- data/lib/cimi/models/machine_image_create.rb +41 -0
- data/lib/cimi/models/machine_template.rb +14 -34
- data/lib/cimi/models/machine_template_create.rb +33 -0
- data/lib/cimi/models/network.rb +0 -38
- data/lib/cimi/models/network_create.rb +43 -0
- data/lib/cimi/models/network_port.rb +17 -17
- data/lib/cimi/models/network_template.rb +2 -3
- data/lib/cimi/models/resource.rb +22 -3
- data/lib/cimi/models/schema.rb +94 -8
- data/lib/cimi/models/system.rb +67 -0
- data/lib/cimi/models/system_template.rb +63 -0
- data/lib/cimi/models/volume.rb +2 -42
- data/lib/cimi/models/volume_configuration.rb +4 -4
- data/lib/cimi/models/volume_create.rb +58 -0
- data/lib/cimi/models/volume_image.rb +8 -17
- data/lib/cimi/models/volume_image_create.rb +47 -0
- data/lib/cimi/models/volume_template.rb +6 -19
- data/lib/cimi/models/volume_template_create.rb +33 -0
- data/lib/db.rb +14 -22
- data/lib/db/volume_template.rb +1 -1
- data/lib/deltacloud/api.rb +6 -5
- data/lib/deltacloud/collections.rb +4 -27
- data/lib/deltacloud/collections/base.rb +4 -0
- data/lib/deltacloud/collections/images.rb +1 -1
- data/lib/deltacloud/collections/instances.rb +2 -2
- data/lib/deltacloud/core_ext/array.rb +1 -0
- data/lib/deltacloud/core_ext/integer.rb +13 -9
- data/lib/deltacloud/core_ext/string.rb +45 -28
- data/lib/deltacloud/drivers/arubacloud/arubacloud_driver.rb +0 -9
- data/lib/deltacloud/drivers/base_driver.rb +45 -16
- data/lib/deltacloud/drivers/digitalocean/digitalocean_driver.rb +78 -8
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +13 -9
- data/lib/deltacloud/drivers/fgcp/fgcp_client.rb +44 -0
- data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +164 -90
- data/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb +74 -0
- data/lib/deltacloud/drivers/mock/data/instances/inst0.yml +3 -3
- data/lib/deltacloud/drivers/mock/data/instances/inst1.yml +3 -3
- data/lib/deltacloud/drivers/mock/data/instances/inst2.yml +3 -3
- data/lib/deltacloud/drivers/mock/mock_client.rb +17 -1
- data/lib/deltacloud/drivers/mock/mock_driver.rb +161 -204
- data/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb +80 -0
- data/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +6 -1
- data/lib/deltacloud/drivers/openstack/openstack_driver.rb +61 -68
- data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +0 -9
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +11 -6
- data/lib/deltacloud/drivers/terremark/terremark_driver.rb +0 -8
- data/lib/deltacloud/drivers/vsphere/vsphere_client.rb +11 -4
- data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +0 -12
- data/lib/deltacloud/helpers/collection_helper.rb +106 -0
- data/lib/deltacloud/helpers/deltacloud_helper.rb +12 -8
- data/lib/deltacloud/models/address.rb +19 -17
- data/lib/deltacloud/models/base_model.rb +29 -26
- data/lib/deltacloud/models/blob.rb +22 -20
- data/lib/deltacloud/models/bucket.rb +21 -16
- data/lib/deltacloud/models/firewall.rb +18 -16
- data/lib/deltacloud/models/firewall_rule.rb +22 -20
- data/lib/deltacloud/models/image.rb +29 -28
- data/lib/deltacloud/models/instance.rb +92 -94
- data/lib/deltacloud/models/instance_address.rb +42 -40
- data/lib/deltacloud/models/instance_profile.rb +28 -26
- data/lib/deltacloud/models/key.rb +47 -45
- data/lib/deltacloud/models/load_balancer.rb +32 -31
- data/lib/deltacloud/models/metric.rb +76 -29
- data/lib/deltacloud/models/provider.rb +15 -13
- data/lib/deltacloud/models/realm.rb +15 -21
- data/lib/deltacloud/models/storage_snapshot.rb +23 -19
- data/lib/deltacloud/models/storage_volume.rb +35 -34
- data/lib/deltacloud/version.rb +1 -1
- data/lib/deltacloud_rack.rb +22 -0
- data/lib/initialize.rb +28 -0
- data/lib/initializers/database_initialize.rb +76 -0
- data/lib/initializers/frontend_initialize.rb +42 -0
- data/lib/initializers/mock_initialize.rb +33 -0
- data/lib/sinatra/rack_logger.rb +35 -24
- data/tests/cimi/collections/cloud_entry_point_test.rb +1 -7
- data/tests/cimi/collections/machine_images_test.rb +2 -2
- data/tests/cimi/collections/machine_templates_test.rb +75 -0
- data/tests/cimi/collections/machines_test.rb +2 -2
- data/tests/cimi/collections/system_templates_test.rb +41 -0
- data/tests/cimi/collections/systems_test.rb +50 -0
- data/tests/cimi/db/database_helper_test.rb +17 -25
- data/tests/cimi/db/db_helper.rb +1 -12
- data/tests/cimi/db/entity_test.rb +7 -8
- data/tests/cimi/model/machine_create_spec.rb +44 -0
- data/tests/cimi/model/machine_template_spec.rb +29 -0
- data/tests/cimi/model/resource_spec.rb +40 -0
- data/tests/cimi/model/schema_spec.rb +37 -0
- data/tests/cimi/spec_helper.rb +3 -0
- data/tests/deltacloud/collections/buckets_collection_test.rb +1 -1
- data/tests/deltacloud/collections/drivers_collection_test.rb +2 -2
- data/tests/deltacloud/collections/hardware_profiles_collection_test.rb +2 -2
- data/tests/deltacloud/collections/images_collection_test.rb +2 -2
- data/tests/deltacloud/collections/instance_states_collection_test.rb +1 -1
- data/tests/deltacloud/collections/instances_collection_test.rb +6 -3
- data/tests/deltacloud/collections/keys_collection_test.rb +2 -2
- data/tests/deltacloud/collections/realms_collection_test.rb +2 -2
- data/tests/deltacloud/collections/storage_snapshots_collection_test.rb +2 -2
- data/tests/deltacloud/collections/storage_volumes_collection_test.rb +2 -2
- data/tests/deltacloud/collections_test.rb +5 -5
- data/tests/deltacloud/common.rb +2 -13
- data/tests/deltacloud/launcher_test.rb +3 -3
- data/tests/deltacloud/rack_test.rb +2 -2
- data/tests/deltacloud/server_test.rb +1 -1
- data/tests/drivers/base/base_driver_test.rb +5 -5
- data/tests/drivers/base/common.rb +2 -12
- data/tests/drivers/ec2/buckets_test.rb +1 -1
- data/tests/drivers/ec2/images_test.rb +2 -2
- data/tests/drivers/ec2/instance_test.rb +6 -6
- data/tests/drivers/ec2/keys_test.rb +3 -3
- data/tests/drivers/ec2/realms_test.rb +2 -2
- data/tests/drivers/ec2/storage_snapshots_test.rb +1 -1
- data/tests/drivers/fgcp/common.rb +32 -0
- data/tests/drivers/fgcp/firewall_test.rb +70 -0
- data/tests/drivers/fgcp/hardware_profiles_test.rb +61 -0
- data/tests/drivers/fgcp/images_test.rb +46 -0
- data/tests/drivers/fgcp/provider_test.rb +27 -0
- data/tests/drivers/fgcp/realms_test.rb +53 -0
- data/tests/drivers/fgcp/storage_volumes_test.rb +58 -0
- data/tests/drivers/gogrid/images_test.rb +2 -2
- data/tests/drivers/gogrid/instances_test.rb +2 -2
- data/tests/drivers/gogrid/realms_test.rb +2 -2
- data/tests/drivers/mock/images_test.rb +4 -4
- data/tests/drivers/mock/instances_test.rb +9 -9
- data/tests/drivers/mock/keys_test.rb +3 -3
- data/tests/drivers/mock/realms_test.rb +2 -2
- data/tests/drivers/mock/storage_snapshots_test.rb +2 -2
- data/tests/drivers/mock/storage_volumes_test.rb +4 -4
- data/tests/drivers/models/instance_test.rb +2 -2
- data/tests/drivers/openstack/images_test.rb +2 -2
- data/tests/drivers/openstack/instances_test.rb +2 -3
- data/tests/drivers/openstack/keys_test.rb +1 -1
- data/tests/drivers/openstack/realms_test.rb +2 -11
- data/tests/drivers/rhevm/common.rb +33 -12
- data/tests/drivers/rhevm/images_test.rb +20 -12
- data/tests/drivers/rhevm/instance_test.rb +62 -46
- data/tests/drivers/rhevm/provider_test.rb +12 -6
- data/tests/drivers/rhevm/realms_test.rb +15 -9
- data/tests/ec2/query_parser_test.rb +1 -1
- data/tests/test_helper.rb +68 -12
- data/views/addresses/show.html.haml +1 -1
- data/views/buckets/show.html.haml +1 -1
- data/views/errors/{500.html.haml → common.html.haml} +0 -0
- data/views/errors/common.xml.haml +17 -0
- data/views/firewalls/index.xml.haml +2 -2
- data/views/firewalls/new.html.haml +2 -2
- data/views/images/show.html.haml +1 -1
- data/views/instances/run_command.html.haml +1 -1
- data/views/instances/show.html.haml +3 -3
- data/views/keys/index.html.haml +1 -0
- data/views/keys/show.html.haml +8 -4
- data/views/keys/show.xml.haml +3 -2
- data/views/load_balancers/new.html.haml +1 -1
- data/views/load_balancers/show.html.haml +2 -2
- data/views/metrics/show.html.haml +1 -1
- data/views/realms/index.html.haml +0 -2
- data/views/realms/show.html.haml +0 -4
- data/views/realms/show.xml.haml +0 -3
- data/views/storage_snapshots/index.html.haml +1 -1
- data/views/storage_snapshots/new.html.haml +1 -1
- data/views/storage_volumes/new.html.haml +2 -2
- data/views/storage_volumes/show.html.haml +3 -3
- metadata +90 -41
- data/views/errors/400.html.haml +0 -41
- data/views/errors/400.xml.haml +0 -3
- data/views/errors/401.html.haml +0 -26
- data/views/errors/401.xml.haml +0 -3
- data/views/errors/403.html.haml +0 -42
- data/views/errors/403.xml.haml +0 -9
- data/views/errors/404.html.haml +0 -28
- data/views/errors/404.xml.haml +0 -3
- data/views/errors/405.html.haml +0 -29
- data/views/errors/405.xml.haml +0 -5
- data/views/errors/409.html.haml +0 -47
- data/views/errors/409.xml.haml +0 -11
- data/views/errors/500.xml.haml +0 -13
- data/views/errors/501.html.haml +0 -44
- data/views/errors/501.xml.haml +0 -1
- data/views/errors/502.html.haml +0 -44
- data/views/errors/502.xml.haml +0 -1
- data/views/errors/504.html.haml +0 -43
- data/views/errors/504.xml.haml +0 -1
@@ -0,0 +1,46 @@
|
|
1
|
+
#$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
2
|
+
require 'require_relative' if RUBY_VERSION < '1.9'
|
3
|
+
|
4
|
+
require_relative 'common.rb'
|
5
|
+
|
6
|
+
describe 'FgcpDriver Images' do
|
7
|
+
|
8
|
+
before do
|
9
|
+
@driver = Deltacloud::new(:fgcp, credentials)
|
10
|
+
VCR.insert_cassette __name__
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
VCR.eject_cassette
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'must throw error when wrong credentials' do
|
18
|
+
Proc.new do
|
19
|
+
@driver.backend.images(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
|
20
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'must return list of images' do
|
24
|
+
imgs = @driver.images
|
25
|
+
imgs.wont_be_empty
|
26
|
+
imgs.first.must_be_kind_of Deltacloud::Image
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'must allow to filter images' do
|
30
|
+
img = @driver.images(:id => 'IMG_3c9820_S24FWXU0Q9VH0JK')
|
31
|
+
img.wont_be_empty
|
32
|
+
img.must_be_kind_of Array
|
33
|
+
img.size.must_equal 1
|
34
|
+
img.first.id.must_equal 'IMG_3c9820_S24FWXU0Q9VH0JK'
|
35
|
+
@driver.images(:id => 'unknown').must_be_empty
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'must allow to retrieve single image' do
|
39
|
+
img = @driver.image(:id => 'IMG_3c9820_S24FWXU0Q9VH0JK')
|
40
|
+
img.wont_be_nil
|
41
|
+
img.must_be_kind_of Deltacloud::Image
|
42
|
+
img.id.must_equal 'IMG_3c9820_S24FWXU0Q9VH0JK'
|
43
|
+
@driver.image(:id => 'unknown').must_be_nil
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'require_relative' if RUBY_VERSION < '1.9'
|
3
|
+
|
4
|
+
require_relative 'common.rb'
|
5
|
+
|
6
|
+
describe 'FgcpDriver Providers' do
|
7
|
+
|
8
|
+
before do
|
9
|
+
@driver = Deltacloud::new(:fgcp, credentials)
|
10
|
+
VCR.insert_cassette __name__
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
VCR.eject_cassette
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'must support listing of available providers' do
|
18
|
+
providers = @driver.providers
|
19
|
+
providers.wont_be_empty
|
20
|
+
providers.each { |p| p.must_be_kind_of Deltacloud::Provider }
|
21
|
+
providers.each { |p| p.name.wont_be_empty }
|
22
|
+
providers.each { |p| p.url.wont_be_empty }
|
23
|
+
providers.each { |p| p.id.wont_be_empty }
|
24
|
+
providers.each { |p| ['fgcp-au', 'fgcp-sg', 'fgcp-uk', 'fgcp-us', 'fgcp-de', 'fgcp-jp-east', 'fgcp-jp-west'].must_include p.id }
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'require_relative' if RUBY_VERSION < '1.9'
|
3
|
+
|
4
|
+
require_relative 'common.rb'
|
5
|
+
|
6
|
+
describe 'FgcpDriver Realms' do
|
7
|
+
|
8
|
+
before do
|
9
|
+
@driver = Deltacloud::new(:fgcp, credentials)
|
10
|
+
VCR.insert_cassette __name__
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
VCR.eject_cassette
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'must throw error when wrong credentials' do
|
18
|
+
Proc.new do
|
19
|
+
@driver.backend.realms(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
|
20
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'must return list of realms' do
|
24
|
+
realms = @driver.realms
|
25
|
+
realms.wont_be_empty
|
26
|
+
realms.first.must_be_kind_of Deltacloud::Realm
|
27
|
+
# assume at least one vsys has been created, with at least 1 tier network
|
28
|
+
realms.size.wont_be :<, 2
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'must allow to filter realms' do
|
32
|
+
realms = @driver.realms(:id => 'UZXC0GRT-ZG8ZJCJ07')
|
33
|
+
realms.wont_be_empty
|
34
|
+
realms.must_be_kind_of Array
|
35
|
+
realms.size.must_equal 1
|
36
|
+
realms.first.id.must_equal 'UZXC0GRT-ZG8ZJCJ07'
|
37
|
+
realms.first.name.must_equal 'Dies-DC-test'
|
38
|
+
realms.first.state.must_equal 'AVAILABLE'
|
39
|
+
@driver.realms(:id => 'unknown').must_be_empty
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'must allow to retrieve single realm' do
|
43
|
+
realm = @driver.realm(:id => 'UZXC0GRT-ZG8ZJCJ07-N-DMZ')
|
44
|
+
realm.wont_be_nil
|
45
|
+
realm.must_be_kind_of Deltacloud::Realm
|
46
|
+
realm.state.must_equal 'AVAILABLE'
|
47
|
+
realm.id.must_equal 'UZXC0GRT-ZG8ZJCJ07-N-DMZ'
|
48
|
+
realm.name.must_equal 'Dies-DC-test [DMZ]'
|
49
|
+
@driver.realm(:id => 'unknown').must_be_nil
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'require_relative' if RUBY_VERSION < '1.9'
|
3
|
+
|
4
|
+
require_relative 'common'
|
5
|
+
|
6
|
+
describe 'FgcpDriver StorageVolumes' do
|
7
|
+
|
8
|
+
before do
|
9
|
+
@driver = Deltacloud::new(:fgcp, credentials)
|
10
|
+
VCR.insert_cassette __name__
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
VCR.eject_cassette
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'must throw error when wrong credentials' do
|
18
|
+
Proc.new do
|
19
|
+
@driver.backend.storage_volumes(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
|
20
|
+
end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'must return list of storage_volumes' do
|
24
|
+
@driver.storage_volumes.wont_be_empty
|
25
|
+
@driver.storage_volumes.first.must_be_kind_of Deltacloud::StorageVolume
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'must allow to filter storage_volumes' do
|
29
|
+
storage_volumes = @driver.storage_volumes(:id => 'UZXC0GRT-ZG8ZJCJ07-D-0039')
|
30
|
+
storage_volumes.wont_be_empty
|
31
|
+
storage_volumes.must_be_kind_of Array
|
32
|
+
storage_volumes.size.must_equal 1
|
33
|
+
storage_volumes.first.id.must_equal 'UZXC0GRT-ZG8ZJCJ07-D-0039'
|
34
|
+
@driver.storage_volumes(:id => 'unknown').must_be_empty
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'must allow to retrieve single storage_volume' do
|
38
|
+
storage_volume = @driver.storage_volume(:id => 'UZXC0GRT-ZG8ZJCJ07-D-0039')
|
39
|
+
storage_volume.wont_be_nil
|
40
|
+
storage_volume.must_be_kind_of Deltacloud::StorageVolume
|
41
|
+
storage_volume.id.must_equal 'UZXC0GRT-ZG8ZJCJ07-D-0039'
|
42
|
+
@driver.storage_volume(:id => 'unknown').must_be_nil
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'must allow to create the storage volume' do
|
46
|
+
volume = @driver.create_storage_volume(:name => 'Test Volume', :capacity => '2')
|
47
|
+
volume.must_be_kind_of Deltacloud::StorageVolume
|
48
|
+
volume.name.must_equal 'Test Volume'
|
49
|
+
volume.capacity.must_equal '10.0' # note that it's rounded up to a multiple of ten
|
50
|
+
volume2 = @driver.storage_volume(:id => volume.id)
|
51
|
+
volume2.wont_be_nil
|
52
|
+
volume2.must_be_kind_of Deltacloud::StorageVolume
|
53
|
+
volume2.id.must_equal volume.id
|
54
|
+
volume2.name.must_equal volume.name
|
55
|
+
volume2.capacity.must_equal volume.capacity
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -29,7 +29,7 @@ describe 'GoGridDriver Images' do
|
|
29
29
|
|
30
30
|
it 'must return list of images' do
|
31
31
|
@driver.images.wont_be_empty
|
32
|
-
@driver.images.first.must_be_kind_of Image
|
32
|
+
@driver.images.first.must_be_kind_of Deltacloud::Image
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'must allow to filter images' do
|
@@ -54,7 +54,7 @@ describe 'GoGridDriver Images' do
|
|
54
54
|
by_id = @driver.image(:id => some_img.id)
|
55
55
|
|
56
56
|
by_id.wont_be_nil
|
57
|
-
by_id.must_be_kind_of Image
|
57
|
+
by_id.must_be_kind_of Deltacloud::Image
|
58
58
|
by_id.id.must_equal some_img.id
|
59
59
|
end
|
60
60
|
|
@@ -63,7 +63,7 @@ describe 'GoGridDriver Instances' do
|
|
63
63
|
|
64
64
|
it 'must return list of instances' do
|
65
65
|
@driver.instances.wont_be_empty
|
66
|
-
@driver.instances.first.must_be_kind_of Instance
|
66
|
+
@driver.instances.first.must_be_kind_of Deltacloud::Instance
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'must allow to filter instances' do
|
@@ -85,7 +85,7 @@ describe 'GoGridDriver Instances' do
|
|
85
85
|
it 'must allow to retrieve single instance' do
|
86
86
|
by_id = @driver.instance(:id => instance.id)
|
87
87
|
by_id.wont_be_nil
|
88
|
-
by_id.must_be_kind_of Instance
|
88
|
+
by_id.must_be_kind_of Deltacloud::Instance
|
89
89
|
by_id.id.must_equal instance.id
|
90
90
|
@driver.instance(:id => "unknown").must_be_nil
|
91
91
|
end
|
@@ -22,7 +22,7 @@ describe 'GoGridDriver Realms' do
|
|
22
22
|
|
23
23
|
it 'must return list of realms' do
|
24
24
|
@driver.realms.wont_be_empty
|
25
|
-
@driver.realms.first.must_be_kind_of Realm
|
25
|
+
@driver.realms.first.must_be_kind_of Deltacloud::Realm
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'must allow to filter realms' do
|
@@ -36,7 +36,7 @@ describe 'GoGridDriver Realms' do
|
|
36
36
|
|
37
37
|
it 'must allow to retrieve single realm' do
|
38
38
|
@driver.realm(:id => '1').wont_be_nil
|
39
|
-
@driver.realm(:id => '1').must_be_kind_of Realm
|
39
|
+
@driver.realm(:id => '1').must_be_kind_of Deltacloud::Realm
|
40
40
|
@driver.realm(:id => '1').id.must_equal '1'
|
41
41
|
@driver.realm(:id => '1').name.must_equal 'US-West-1'
|
42
42
|
@driver.realm(:id => 'unknown').must_be_nil
|
@@ -17,7 +17,7 @@ describe 'MockDriver Images' do
|
|
17
17
|
|
18
18
|
it 'must return list of images' do
|
19
19
|
@driver.images.wont_be_empty
|
20
|
-
@driver.images.first.must_be_kind_of Image
|
20
|
+
@driver.images.first.must_be_kind_of Deltacloud::Image
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must allow to filter images' do
|
@@ -32,13 +32,13 @@ describe 'MockDriver Images' do
|
|
32
32
|
|
33
33
|
it 'must allow to retrieve single image' do
|
34
34
|
@driver.image(:id => 'img1').wont_be_nil
|
35
|
-
@driver.image(:id => 'img1').must_be_kind_of Image
|
35
|
+
@driver.image(:id => 'img1').must_be_kind_of Deltacloud::Image
|
36
36
|
@driver.image(:id => 'img1').id.must_equal 'img1'
|
37
37
|
@driver.image(:id => 'unknown').must_be_nil
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'must allow to create a new image if instance supported' do
|
41
|
-
@driver.create_image(:id => 'inst1', :name => 'img1-test', :description => 'Test1').must_be_kind_of Image
|
41
|
+
@driver.create_image(:id => 'inst1', :name => 'img1-test', :description => 'Test1').must_be_kind_of Deltacloud::Image
|
42
42
|
@driver.image(:id => 'img1-test').wont_be_nil
|
43
43
|
@driver.image(:id => 'img1-test').id.must_equal 'img1-test'
|
44
44
|
@driver.image(:id => 'img1-test').name.must_equal 'img1-test'
|
@@ -48,7 +48,7 @@ describe 'MockDriver Images' do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'must allow to destroy created image' do
|
51
|
-
@driver.create_image(:id => 'inst1', :name => 'img1-test-destroy').must_be_kind_of Image
|
51
|
+
@driver.create_image(:id => 'inst1', :name => 'img1-test-destroy').must_be_kind_of Deltacloud::Image
|
52
52
|
@driver.destroy_image('img1-test-destroy')
|
53
53
|
@driver.image(:id => 'img1-test-destroy').must_be_nil
|
54
54
|
end
|
@@ -17,7 +17,7 @@ describe 'MockDriver Instances' do
|
|
17
17
|
|
18
18
|
it 'must return list of instances' do
|
19
19
|
@driver.instances.wont_be_empty
|
20
|
-
@driver.instances.first.must_be_kind_of Instance
|
20
|
+
@driver.instances.first.must_be_kind_of Deltacloud::Instance
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must allow to filter instances' do
|
@@ -32,14 +32,14 @@ describe 'MockDriver Instances' do
|
|
32
32
|
|
33
33
|
it 'must allow to retrieve single instance' do
|
34
34
|
@driver.instance(:id => 'inst1').wont_be_nil
|
35
|
-
@driver.instance(:id => 'inst1').must_be_kind_of Instance
|
35
|
+
@driver.instance(:id => 'inst1').must_be_kind_of Deltacloud::Instance
|
36
36
|
@driver.instance(:id => 'inst1').id.must_equal 'inst1'
|
37
37
|
@driver.instance(:id => 'unknown').must_be_nil
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'must allow to create a new instance if instance supported' do
|
41
41
|
instance = @driver.create_instance('img1', :name => 'inst1-test', :realm_id => 'us', :hwp_id => 'm1-small')
|
42
|
-
instance.must_be_kind_of Instance
|
42
|
+
instance.must_be_kind_of Deltacloud::Instance
|
43
43
|
@driver.instance(:id => instance.id).wont_be_nil
|
44
44
|
@driver.instance(:id => instance.id).id.must_equal instance.id
|
45
45
|
@driver.instance(:id => instance.id).name.must_equal 'inst1-test'
|
@@ -62,14 +62,14 @@ describe 'MockDriver Instances' do
|
|
62
62
|
|
63
63
|
it 'must allow to destroy created instance' do
|
64
64
|
instance = @driver.create_instance('img1', :name => 'inst1-test-destroy')
|
65
|
-
instance.must_be_kind_of Instance
|
65
|
+
instance.must_be_kind_of Deltacloud::Instance
|
66
66
|
@driver.destroy_instance(instance.id)
|
67
67
|
@driver.instance(:id => instance.id).must_be_nil
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'must allow to stop instance in running state' do
|
71
71
|
instance = @driver.create_instance('img1', :name => 'inst1-test-destroy')
|
72
|
-
instance.must_be_kind_of Instance
|
72
|
+
instance.must_be_kind_of Deltacloud::Instance
|
73
73
|
instance.state.must_equal 'RUNNING'
|
74
74
|
@driver.stop_instance(instance.id)
|
75
75
|
@driver.instance(:id => instance.id).state.must_equal 'STOPPED'
|
@@ -79,7 +79,7 @@ describe 'MockDriver Instances' do
|
|
79
79
|
|
80
80
|
it 'must allow to start instance in stopped state' do
|
81
81
|
instance = @driver.create_instance('img1', :name => 'inst1-test-destroy')
|
82
|
-
instance.must_be_kind_of Instance
|
82
|
+
instance.must_be_kind_of Deltacloud::Instance
|
83
83
|
instance.state.must_equal 'RUNNING'
|
84
84
|
@driver.stop_instance(instance.id)
|
85
85
|
@driver.instance(:id => instance.id).state.must_equal 'STOPPED'
|
@@ -91,7 +91,7 @@ describe 'MockDriver Instances' do
|
|
91
91
|
|
92
92
|
it 'must allow to reboot instance in running state' do
|
93
93
|
instance = @driver.create_instance('img1', :name => 'inst1-test-destroy')
|
94
|
-
instance.must_be_kind_of Instance
|
94
|
+
instance.must_be_kind_of Deltacloud::Instance
|
95
95
|
instance.state.must_equal 'RUNNING'
|
96
96
|
@driver.reboot_instance(instance.id)
|
97
97
|
@driver.instance(:id => instance.id).state.must_equal 'RUNNING'
|
@@ -105,8 +105,8 @@ describe 'MockDriver Instances' do
|
|
105
105
|
|
106
106
|
it 'must support run_on_instance' do
|
107
107
|
run_cmd = @driver.run_on_instance(:cmd => 'uname', :port => '22', :private_key => '123', :ip => '127.0.0.1')
|
108
|
-
run_cmd.body.must_equal
|
109
|
-
run_cmd.ssh.must_be_kind_of Deltacloud::Drivers::Mock::MockDriver::
|
108
|
+
run_cmd.body.must_equal "This is where the output from 'uname' would appear if this were not a mock provider"
|
109
|
+
run_cmd.ssh.must_be_kind_of Deltacloud::Drivers::Mock::MockDriver::MockSSH
|
110
110
|
run_cmd.ssh.command.must_equal 'uname'
|
111
111
|
end
|
112
112
|
|
@@ -17,7 +17,7 @@ describe 'MockDriver Keys' do
|
|
17
17
|
|
18
18
|
it 'must return list of keys' do
|
19
19
|
@driver.keys.wont_be_empty
|
20
|
-
@driver.keys.first.must_be_kind_of Key
|
20
|
+
@driver.keys.first.must_be_kind_of Deltacloud::Key
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must allow to filter keys' do
|
@@ -30,7 +30,7 @@ describe 'MockDriver Keys' do
|
|
30
30
|
|
31
31
|
it 'must allow to retrieve single key' do
|
32
32
|
@driver.key(:id => 'test-key').wont_be_nil
|
33
|
-
@driver.key(:id => 'test-key').must_be_kind_of Key
|
33
|
+
@driver.key(:id => 'test-key').must_be_kind_of Deltacloud::Key
|
34
34
|
@driver.key(:id => 'test-key').id.must_equal 'test-key'
|
35
35
|
@driver.key(:id => 'unknown').must_be_nil
|
36
36
|
end
|
@@ -38,7 +38,7 @@ describe 'MockDriver Keys' do
|
|
38
38
|
it 'must allow to create a new key' do
|
39
39
|
key = @driver.create_key(:key_name => 'test1')
|
40
40
|
key.wont_be_nil
|
41
|
-
key.must_be_kind_of Key
|
41
|
+
key.must_be_kind_of Deltacloud::Key
|
42
42
|
Proc.new { @driver.create_key(:key_name => 'test1') }.must_raise Deltacloud::Exceptions::ForbiddenError, 'KeyExist'
|
43
43
|
@driver.destroy_key :id => key.id
|
44
44
|
@driver.key(:id => key.id).must_be_nil
|
@@ -17,7 +17,7 @@ describe 'MockDriver Realms' do
|
|
17
17
|
|
18
18
|
it 'must return list of realms' do
|
19
19
|
@driver.realms.wont_be_empty
|
20
|
-
@driver.realms.first.must_be_kind_of Realm
|
20
|
+
@driver.realms.first.must_be_kind_of Deltacloud::Realm
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must allow to filter realms' do
|
@@ -30,7 +30,7 @@ describe 'MockDriver Realms' do
|
|
30
30
|
|
31
31
|
it 'must allow to retrieve single realm' do
|
32
32
|
@driver.realm(:id => 'us').wont_be_nil
|
33
|
-
@driver.realm(:id => 'us').must_be_kind_of Realm
|
33
|
+
@driver.realm(:id => 'us').must_be_kind_of Deltacloud::Realm
|
34
34
|
@driver.realm(:id => 'us').id.must_equal 'us'
|
35
35
|
@driver.realm(:id => 'unknown').must_be_nil
|
36
36
|
end
|
@@ -17,7 +17,7 @@ describe 'MockDriver StorageSnapshots' do
|
|
17
17
|
|
18
18
|
it 'must return list of storage_snapshots' do
|
19
19
|
@driver.storage_snapshots.wont_be_empty
|
20
|
-
@driver.storage_snapshots.first.must_be_kind_of StorageSnapshot
|
20
|
+
@driver.storage_snapshots.first.must_be_kind_of Deltacloud::StorageSnapshot
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must allow to filter storage_snapshots' do
|
@@ -30,7 +30,7 @@ describe 'MockDriver StorageSnapshots' do
|
|
30
30
|
|
31
31
|
it 'must allow to retrieve single storage_snapshot' do
|
32
32
|
@driver.storage_snapshot(:id => 'snap1').wont_be_nil
|
33
|
-
@driver.storage_snapshot(:id => 'snap1').must_be_kind_of StorageSnapshot
|
33
|
+
@driver.storage_snapshot(:id => 'snap1').must_be_kind_of Deltacloud::StorageSnapshot
|
34
34
|
@driver.storage_snapshot(:id => 'snap1').id.must_equal 'snap1'
|
35
35
|
@driver.storage_snapshot(:id => 'unknown').must_be_nil
|
36
36
|
end
|
@@ -17,7 +17,7 @@ describe 'MockDriver StorageVolumes' do
|
|
17
17
|
|
18
18
|
it 'must return list of storage_volumes' do
|
19
19
|
@driver.storage_volumes.wont_be_empty
|
20
|
-
@driver.storage_volumes.first.must_be_kind_of StorageVolume
|
20
|
+
@driver.storage_volumes.first.must_be_kind_of Deltacloud::StorageVolume
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'must allow to filter storage_volumes' do
|
@@ -30,14 +30,14 @@ describe 'MockDriver StorageVolumes' do
|
|
30
30
|
|
31
31
|
it 'must allow to retrieve single storage_volume' do
|
32
32
|
@driver.storage_volume(:id => 'vol1').wont_be_nil
|
33
|
-
@driver.storage_volume(:id => 'vol1').must_be_kind_of StorageVolume
|
33
|
+
@driver.storage_volume(:id => 'vol1').must_be_kind_of Deltacloud::StorageVolume
|
34
34
|
@driver.storage_volume(:id => 'vol1').id.must_equal 'vol1'
|
35
35
|
@driver.storage_volume(:id => 'unknown').must_be_nil
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'must allow to create and destroy the storage volume' do
|
39
39
|
volume = @driver.create_storage_volume(:name => 'Test Volume', :capacity => '100')
|
40
|
-
volume.must_be_kind_of StorageVolume
|
40
|
+
volume.must_be_kind_of Deltacloud::StorageVolume
|
41
41
|
volume.name.must_equal 'Test Volume'
|
42
42
|
volume.capacity.must_equal '100'
|
43
43
|
@driver.destroy_storage_volume(:id => volume.id)
|
@@ -46,7 +46,7 @@ describe 'MockDriver StorageVolumes' do
|
|
46
46
|
|
47
47
|
it 'must allow to attach and detach storage volume to instance' do
|
48
48
|
volume = @driver.create_storage_volume(:name => 'Test Volume', :capacity => '100')
|
49
|
-
volume.must_be_kind_of StorageVolume
|
49
|
+
volume.must_be_kind_of Deltacloud::StorageVolume
|
50
50
|
@driver.attach_storage_volume(:id => volume.id, :device => '/dev/sda', :instance_id => 'inst1')
|
51
51
|
@driver.storage_volume(:id => volume.id).instance_id.must_equal 'inst1'
|
52
52
|
@driver.storage_volume(:id => volume.id).device.must_equal '/dev/sda'
|
@@ -3,10 +3,10 @@ require 'require_relative' if RUBY_VERSION < '1.9'
|
|
3
3
|
|
4
4
|
require_relative 'common'
|
5
5
|
|
6
|
-
describe Instance do
|
6
|
+
describe Deltacloud::Instance do
|
7
7
|
|
8
8
|
before do
|
9
|
-
@instance = Instance.new(
|
9
|
+
@instance = Deltacloud::Instance.new(
|
10
10
|
:id => 'inst1',
|
11
11
|
:create_image => true,
|
12
12
|
:name => 'Instance',
|