fog-maestrodev 1.14.0.20130806165225 → 1.15.0.20130829165835
Sign up to get free protection for your applications and to get access to all the features.
- data/changelog.txt +296 -0
- data/fog.gemspec +2 -2
- data/lib/fog/atmos/storage.rb +0 -3
- data/lib/fog/aws/cdn.rb +1 -2
- data/lib/fog/aws/compute.rb +52 -2
- data/lib/fog/aws/dns.rb +0 -1
- data/lib/fog/aws/models/auto_scaling/groups.rb +6 -3
- data/lib/fog/aws/models/compute/address.rb +1 -0
- data/lib/fog/aws/models/compute/flavors.rb +19 -0
- data/lib/fog/aws/models/compute/route_table.rb +69 -0
- data/lib/fog/aws/models/compute/route_tables.rb +92 -0
- data/lib/fog/aws/models/rds/instance_option.rb +21 -0
- data/lib/fog/aws/models/rds/instance_options.rb +30 -0
- data/lib/fog/aws/parsers/compute/associate_route_table.rb +20 -0
- data/lib/fog/aws/parsers/compute/create_route_table.rb +75 -0
- data/lib/fog/aws/parsers/compute/describe_account_attributes.rb +42 -0
- data/lib/fog/aws/parsers/compute/describe_route_tables.rb +85 -0
- data/lib/fog/aws/parsers/rds/describe_orderable_db_instance_options.rb +47 -0
- data/lib/fog/aws/rds.rb +5 -0
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_groups.rb +9 -1
- data/lib/fog/aws/requests/auto_scaling/describe_policies.rb +15 -1
- data/lib/fog/aws/requests/compute/associate_dhcp_options.rb +2 -2
- data/lib/fog/aws/requests/compute/associate_route_table.rb +75 -0
- data/lib/fog/aws/requests/compute/attach_internet_gateway.rb +2 -2
- data/lib/fog/aws/requests/compute/create_route.rb +89 -0
- data/lib/fog/aws/requests/compute/create_route_table.rb +70 -0
- data/lib/fog/aws/requests/compute/create_vpc.rb +16 -1
- data/lib/fog/aws/requests/compute/delete_dhcp_options.rb +2 -2
- data/lib/fog/aws/requests/compute/delete_internet_gateway.rb +2 -2
- data/lib/fog/aws/requests/compute/delete_network_interface.rb +2 -2
- data/lib/fog/aws/requests/compute/delete_route.rb +60 -0
- data/lib/fog/aws/requests/compute/delete_route_table.rb +51 -0
- data/lib/fog/aws/requests/compute/delete_subnet.rb +2 -2
- data/lib/fog/aws/requests/compute/delete_vpc.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_account_attributes.rb +49 -0
- data/lib/fog/aws/requests/compute/describe_route_tables.rb +87 -0
- data/lib/fog/aws/requests/compute/detach_internet_gateway.rb +2 -2
- data/lib/fog/aws/requests/compute/detach_network_interface.rb +2 -2
- data/lib/fog/aws/requests/compute/disassociate_route_table.rb +57 -0
- data/lib/fog/aws/requests/compute/reset_network_interface_attribute.rb +2 -1
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +23 -9
- data/lib/fog/aws/requests/iam/upload_server_certificate.rb +1 -1
- data/lib/fog/aws/requests/rds/describe_orderable_db_instance_options.rb +76 -0
- data/lib/fog/aws/storage.rb +0 -2
- data/lib/fog/brightbox/models/compute/collaboration.rb +10 -2
- data/lib/fog/brightbox/models/compute/collaborations.rb +26 -2
- data/lib/fog/brightbox/models/compute/user_collaboration.rb +16 -1
- data/lib/fog/brightbox/models/compute/user_collaborations.rb +10 -2
- data/lib/fog/cloudstack/models/compute/server.rb +4 -0
- data/lib/fog/core/collection.rb +18 -0
- data/lib/fog/core/credentials.rb +6 -1
- data/lib/fog/google/compute.rb +17 -0
- data/lib/fog/google/examples/get_list_images.rb +27 -0
- data/lib/fog/google/examples/get_list_snapshots.rb +20 -0
- data/lib/fog/google/examples/image_create.rb +18 -0
- data/lib/fog/google/examples/launch_micro_instance.rb +10 -5
- data/lib/fog/google/examples/network.rb +21 -0
- data/lib/fog/google/models/compute/disk.rb +16 -5
- data/lib/fog/google/models/compute/image.rb +36 -18
- data/lib/fog/google/models/compute/images.rb +36 -10
- data/lib/fog/google/models/compute/server.rb +41 -11
- data/lib/fog/google/models/compute/servers.rb +1 -1
- data/lib/fog/google/models/compute/snapshot.rb +36 -0
- data/lib/fog/google/models/compute/snapshots.rb +28 -0
- data/lib/fog/google/requests/compute/delete_disk.rb +5 -1
- data/lib/fog/google/requests/compute/get_disk.rb +2 -1
- data/lib/fog/google/requests/compute/get_snapshot.rb +34 -0
- data/lib/fog/google/requests/compute/insert_disk.rb +23 -7
- data/lib/fog/google/requests/compute/insert_image.rb +16 -9
- data/lib/fog/google/requests/compute/insert_server.rb +22 -10
- data/lib/fog/google/requests/compute/list_disks.rb +1 -1
- data/lib/fog/google/requests/compute/list_snapshots.rb +30 -0
- data/lib/fog/google/storage.rb +1 -3
- data/lib/fog/hp/storage.rb +0 -2
- data/lib/fog/internet_archive/storage.rb +0 -2
- data/lib/fog/local/storage.rb +0 -2
- data/lib/fog/ninefold/storage.rb +0 -1
- data/lib/fog/openstack/models/storage/file.rb +2 -0
- data/lib/fog/openstack/requests/compute/add_flavor_access.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_volume.rb +8 -7
- data/lib/fog/openstack/requests/compute/list_tenants_with_flavor_access.rb +1 -1
- data/lib/fog/openstack/requests/compute/remove_flavor_access.rb +1 -1
- data/lib/fog/openstack/requests/image/create_image.rb +23 -23
- data/lib/fog/openstack/requests/image/update_image.rb +31 -33
- data/lib/fog/openstack/requests/storage/get_object_https_url.rb +3 -3
- data/lib/fog/openstack/requests/storage/post_set_meta_temp_url_key.rb +1 -1
- data/lib/fog/openstack/storage.rb +10 -11
- data/lib/fog/openstack.rb +10 -1
- data/lib/fog/rackspace/cdn.rb +13 -0
- data/lib/fog/rackspace/compute.rb +8 -4
- data/lib/fog/rackspace/compute_v2.rb +2 -0
- data/lib/fog/rackspace/databases.rb +4 -4
- data/lib/fog/rackspace/dns.rb +6 -6
- data/lib/fog/rackspace/examples/compute_v2/bootstrap_server.rb +98 -0
- data/lib/fog/rackspace/load_balancers.rb +5 -4
- data/lib/fog/rackspace/models/compute_v2/flavors.rb +1 -2
- data/lib/fog/rackspace/models/compute_v2/images.rb +35 -3
- data/lib/fog/rackspace/models/compute_v2/metadatum.rb +2 -2
- data/lib/fog/rackspace/models/identity/service_catalog.rb +34 -16
- data/lib/fog/rackspace/models/load_balancers/load_balancer.rb +8 -3
- data/lib/fog/rackspace/models/monitoring/alarm.rb +16 -8
- data/lib/fog/rackspace/models/monitoring/base.rb +2 -8
- data/lib/fog/rackspace/monitoring.rb +14 -6
- data/lib/fog/rackspace/requests/compute_v2/list_flavors_detail.rb +39 -0
- data/lib/fog/rackspace/requests/compute_v2/list_images.rb +15 -5
- data/lib/fog/rackspace/requests/compute_v2/list_images_detail.rb +53 -0
- data/lib/fog/rackspace/requests/identity/create_token.rb +1 -1
- data/lib/fog/rackspace/requests/load_balancers/create_load_balancer.rb +12 -0
- data/lib/fog/rackspace/requests/load_balancers/get_stats.rb +31 -0
- data/lib/fog/rackspace/requests/monitoring/get_entity.rb +33 -0
- data/lib/fog/rackspace/service.rb +7 -0
- data/lib/fog/rackspace/storage.rb +6 -3
- data/lib/fog/rackspace.rb +8 -5
- data/lib/fog/riakcs/provisioning.rb +0 -1
- data/lib/fog/riakcs/usage.rb +2 -3
- data/lib/fog/storage.rb +2 -0
- data/lib/fog/vcloud/examples/README.md +54 -0
- data/lib/fog/vcloud/examples/creating_a_connection.md +20 -0
- data/lib/fog/vcloud/examples/creating_a_vapp.md +17 -0
- data/lib/fog/vcloud/examples/get_network_information.md +10 -0
- data/lib/fog/vcloud/examples/get_vapp_information.md +10 -0
- data/lib/fog/vcloud/examples/more_on_vapps.md +23 -0
- data/lib/fog/version.rb +1 -1
- data/lib/tasks/changelog_task.rb +1 -0
- data/tests/aws/models/elb/model_tests.rb +5 -0
- data/tests/aws/models/rds/instance_option_tests.rb +14 -0
- data/tests/aws/requests/compute/client_tests.rb +25 -0
- data/tests/aws/requests/compute/route_tests.rb +277 -0
- data/tests/aws/requests/rds/helper.rb +22 -0
- data/tests/aws/requests/rds/instance_option_tests.rb +21 -0
- data/tests/core/credential_tests.rb +21 -0
- data/tests/core/service_tests.rb +26 -0
- data/tests/openstack/authenticate_tests.rb +22 -0
- data/tests/openstack/models/storage/file_tests.rb +20 -1
- data/tests/openstack/requests/compute/flavor_tests.rb +27 -12
- data/tests/openstack/requests/compute/volume_tests.rb +10 -12
- data/tests/openstack/requests/image/image_tests.rb +30 -15
- data/tests/rackspace/block_storage_tests.rb +9 -4
- data/tests/rackspace/cdn_tests.rb +14 -0
- data/tests/rackspace/compute_tests.rb +10 -4
- data/tests/rackspace/compute_v2_tests.rb +9 -4
- data/tests/rackspace/databases_tests.rb +9 -4
- data/tests/rackspace/dns_tests.rb +9 -4
- data/tests/rackspace/helper.rb +21 -2
- data/tests/rackspace/identity_tests.rb +9 -4
- data/tests/rackspace/load_balancer_tests.rb +8 -4
- data/tests/rackspace/models/compute_v2/server_tests.rb +18 -21
- data/tests/rackspace/models/identity/service_catalog_tests.rb +54 -29
- data/tests/rackspace/models/load_balancers/load_balancer_tests.rb +5 -0
- data/tests/rackspace/models/monitoring/alarm_examples_tests.rb +1 -1
- data/tests/rackspace/models/monitoring/alarm_tests.rb +2 -2
- data/tests/rackspace/monitoring_tests.rb +9 -4
- data/tests/rackspace/requests/compute_v2/flavor_tests.rb +6 -0
- data/tests/rackspace/requests/compute_v2/image_tests.rb +4 -0
- data/tests/rackspace/requests/compute_v2/server_tests.rb +2 -2
- data/tests/rackspace/requests/load_balancers/get_stats_tests.rb +13 -0
- data/tests/rackspace/requests/load_balancers/helper.rb +9 -0
- data/tests/rackspace/requests/monitoring/alarm_tests.rb +4 -5
- data/tests/rackspace/requests/monitoring/entity_tests.rb +9 -1
- data/tests/rackspace/requests/storage/large_object_tests.rb +12 -4
- data/tests/rackspace/storage_tests.rb +23 -4
- data/tests/rackspace/url_encoding_tests.rb +3 -1
- metadata +117 -133
- checksums.yaml +0 -15
- data/lib/fog/aws/parsers/compute/associate_dhcp_options.rb +0 -24
- data/lib/fog/aws/parsers/compute/attach_internet_gateway.rb +0 -24
- data/lib/fog/aws/parsers/compute/delete_dhcp_options.rb +0 -24
- data/lib/fog/aws/parsers/compute/delete_internet_gateway.rb +0 -24
- data/lib/fog/aws/parsers/compute/delete_network_interface.rb +0 -24
- data/lib/fog/aws/parsers/compute/delete_subnet.rb +0 -24
- data/lib/fog/aws/parsers/compute/delete_vpc.rb +0 -24
- data/lib/fog/aws/parsers/compute/detach_internet_gateway.rb +0 -24
- data/lib/fog/aws/parsers/compute/detach_network_interface.rb +0 -24
@@ -0,0 +1,23 @@
|
|
1
|
+
# More on vApps
|
2
|
+
|
3
|
+
## Checking running or stopped
|
4
|
+
|
5
|
+
selected_vapp = connection.servers.service.vapps.detect { |n| n.name == 'vapp-name' }
|
6
|
+
selected_vapp.on?
|
7
|
+
selected_vapp.off?
|
8
|
+
|
9
|
+
## Wait for app to come up or stop
|
10
|
+
|
11
|
+
selected_vapp.wait_for { selected_vapp.on? }
|
12
|
+
selected_vapp.wait_for { selected_vapp.off? }
|
13
|
+
|
14
|
+
## Delete vApp
|
15
|
+
|
16
|
+
selected_vapp = connection.servers.service.vapps.detect { |n| n.name == 'vapp-name' }
|
17
|
+
vapp = connection.servers.service.get_vapp(selected_vapp.href)
|
18
|
+
if vapp.on?
|
19
|
+
vapp.service.undeploy selected_vapp.href #undeploy to stop vApp
|
20
|
+
vapp.wait_for { vapp.off? }
|
21
|
+
end
|
22
|
+
vapp.wait_for { vapp.off? } #double check
|
23
|
+
vapp.service.delete_vapp selected_vapp.href
|
data/lib/fog/version.rb
CHANGED
data/lib/tasks/changelog_task.rb
CHANGED
@@ -57,7 +57,10 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
tests('with vpc') do
|
60
|
+
Fog::Compute[:aws].ec2_compatibility_mode(false)
|
60
61
|
elb2 = Fog::AWS[:elb].load_balancers.create(:id => "#{elb_id}-2", :subnet_ids => [@subnet_id])
|
62
|
+
tests("elb source group should be default_elb*").returns(true) { !!(elb2.source_group["GroupName"] =~ /default_elb_*/) }
|
63
|
+
tests("should have a 'default_elb_*' security group").returns(true) { Fog::Compute[:aws].security_groups.all.any? { |sg| sg.name =~ /default_elb/ } }
|
61
64
|
tests("subnet ids are correct").returns(@subnet_id) { elb2.subnet_ids.first }
|
62
65
|
elb2.destroy
|
63
66
|
end
|
@@ -75,8 +78,10 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
|
|
75
78
|
end
|
76
79
|
|
77
80
|
tests('with availability zones') do
|
81
|
+
Fog::Compute[:aws].ec2_compatibility_mode(true)
|
78
82
|
azs = @availability_zones[1..-1]
|
79
83
|
elb2 = Fog::AWS[:elb].load_balancers.create(:id => "#{elb_id}-2", :availability_zones => azs)
|
84
|
+
tests("elb source group should be amazon-elb-sg").returns(true) { elb2.source_group["GroupName"] == 'amazon-elb-sg' }
|
80
85
|
tests("availability zones are correct").returns(azs.sort) { elb2.availability_zones.sort }
|
81
86
|
elb2.destroy
|
82
87
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Shindo.tests("AWS::RDS | db instance options", ['aws', 'rds']) do
|
2
|
+
|
3
|
+
params = {:engine => 'mysql'}
|
4
|
+
|
5
|
+
pending if Fog.mocking?
|
6
|
+
|
7
|
+
tests('#options') do
|
8
|
+
tests 'contains options' do
|
9
|
+
@instance = Fog::AWS[:rds].instance_options.new(params)
|
10
|
+
returns(true) { @instance.engine == 'mysql' }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:aws] | account tests', ['aws']) do
|
2
|
+
if Fog.mocking?
|
3
|
+
tests('check for vpc') do
|
4
|
+
tests('supports both vpc and ec2 in compatibility mode').succeeds do
|
5
|
+
client = Fog::Compute[:aws]
|
6
|
+
client.ec2_compatibility_mode(true)
|
7
|
+
data = Fog::Compute[:aws].describe_account_attributes.body
|
8
|
+
data['accountAttributeSet'].any? { |s| [*s["values"]].include?("VPC") && [*s["values"]].include?("EC2") }
|
9
|
+
end
|
10
|
+
tests('supports VPC in vpc mode').succeeds do
|
11
|
+
client = Fog::Compute[:aws]
|
12
|
+
client.ec2_compatibility_mode(true)
|
13
|
+
data = Fog::Compute[:aws].describe_account_attributes.body
|
14
|
+
data['accountAttributeSet'].any? { |s| [*s["values"]].include?("VPC") }
|
15
|
+
end
|
16
|
+
|
17
|
+
tests('does not support VPC and EC2 in vpc mode').succeeds do
|
18
|
+
client = Fog::Compute[:aws]
|
19
|
+
client.ec2_compatibility_mode(false)
|
20
|
+
data = Fog::Compute[:aws].describe_account_attributes.body
|
21
|
+
!data['accountAttributeSet'].any? { |s| [*s["values"]].include?("VPC") && [*s["values"]].include?("EC2") }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,277 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:aws] | route table requests', ['aws']) do
|
2
|
+
|
3
|
+
@route_table_format = {
|
4
|
+
'routeTable' => [{
|
5
|
+
'routeSet' => [{
|
6
|
+
'destinationCidrBlock' => String,
|
7
|
+
'gatewayId' => String,
|
8
|
+
'state' => String,
|
9
|
+
}],
|
10
|
+
'tagSet' => Hash,
|
11
|
+
'associationSet' => Array,
|
12
|
+
'routeTableId' => String,
|
13
|
+
'vpcId' => String,
|
14
|
+
}],
|
15
|
+
'requestId' => String
|
16
|
+
}
|
17
|
+
|
18
|
+
@route_tables_format = {
|
19
|
+
'routeTableSet' => [{
|
20
|
+
'associationSet' => [{
|
21
|
+
'routeTableAssociationId' => Fog::Nullable::String,
|
22
|
+
'routeTableId' => String,
|
23
|
+
'subnetId' => Fog::Nullable::String,
|
24
|
+
'main' => Fog::Boolean
|
25
|
+
}],
|
26
|
+
'tagSet' => Hash,
|
27
|
+
'routeSet' => [{
|
28
|
+
'destinationCidrBlock' => String,
|
29
|
+
'gatewayId' => Fog::Nullable::String,
|
30
|
+
'instanceId' => Fog::Nullable::String,
|
31
|
+
'instanceOwnerId' => Fog::Nullable::String,
|
32
|
+
'networkInterfaceId' => Fog::Nullable::String,
|
33
|
+
'state' => String,
|
34
|
+
'origin' => String
|
35
|
+
}],
|
36
|
+
'routeTableId' => String,
|
37
|
+
'vpcId' => String,
|
38
|
+
}],
|
39
|
+
'requestId' => String
|
40
|
+
}
|
41
|
+
|
42
|
+
vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
|
43
|
+
if !Fog.mocking?
|
44
|
+
vpc.wait_for { state.eql? "available" }
|
45
|
+
end
|
46
|
+
@subnet_id = Fog::Compute[:aws].create_subnet(vpc.id, '10.0.10.0/24').body['subnetSet'].first['subnetId']
|
47
|
+
@network_interface = Fog::Compute[:aws].create_network_interface(@subnet_id, {"PrivateIpAddress" => "10.0.10.23"}).body
|
48
|
+
@internet_gateway_id = Fog::Compute[:aws].create_internet_gateway.body['internetGatewaySet'].first['internetGatewayId']
|
49
|
+
@network_interface_id = @network_interface['networkInterface']['networkInterfaceId']
|
50
|
+
key_name = 'fog-test-key'
|
51
|
+
key = Fog::Compute[:aws].key_pairs.create(:name => key_name)
|
52
|
+
@cidr_block = '10.0.10.0/24'
|
53
|
+
@destination_cidr_block = '10.0.10.0/23'
|
54
|
+
@ami = 'ami-79c0ae10' # ubuntu 12.04 daily build 20120728
|
55
|
+
|
56
|
+
tests('success') do
|
57
|
+
|
58
|
+
# Test create_route_table
|
59
|
+
#
|
60
|
+
tests("#create_route_table('#{vpc.id}')").formats(@route_table_format) do
|
61
|
+
data = Fog::Compute[:aws].create_route_table(vpc.id).body
|
62
|
+
@route_table_id = data['routeTable'].first['routeTableId']
|
63
|
+
data
|
64
|
+
end
|
65
|
+
|
66
|
+
# Test associate_route_table
|
67
|
+
#
|
68
|
+
tests("#associate_route_table('#{@route_table_id}', '#{@subnet_id}')").formats({'requestId'=>String, 'associationId'=>String}) do
|
69
|
+
data = Fog::Compute[:aws].associate_route_table(@route_table_id, @subnet_id).body
|
70
|
+
@association_id = data['associationId']
|
71
|
+
data
|
72
|
+
end
|
73
|
+
|
74
|
+
# Tests create_route
|
75
|
+
# - using internet gateway
|
76
|
+
# - using instance id
|
77
|
+
# - using network interface
|
78
|
+
#
|
79
|
+
Fog::Compute[:aws].attach_internet_gateway(@internet_gateway_id, vpc.id).body
|
80
|
+
tests("#create_route('#{@route_table_id}', '#{@destination_cidr_block}', '#{@internet_gateway_id}', 'nil')").formats(AWS::Compute::Formats::BASIC) do
|
81
|
+
Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, @internet_gateway_id, nil).body
|
82
|
+
end
|
83
|
+
|
84
|
+
instance = Fog::Compute[:aws].servers.create(:image_id => @ami, :flavor_id => 't1.micro', :key_name => 'fog-test-key', :subnet_id => @subnet_id)
|
85
|
+
instance.wait_for { state.eql? "running" }
|
86
|
+
tests("#create_route('#{@route_table_id}', '10.0.10.0/22', 'nil', '#{instance.id}')").formats(AWS::Compute::Formats::BASIC) do
|
87
|
+
Fog::Compute[:aws].create_route(@route_table_id, '10.0.10.0/22', nil, instance.id).body
|
88
|
+
end
|
89
|
+
|
90
|
+
tests("#create_route('#{@route_table_id}', '10.0.10.0/21', 'nil', 'nil', '#{@network_interface_id}')").formats(AWS::Compute::Formats::BASIC) do
|
91
|
+
Fog::Compute[:aws].create_route(@route_table_id, '10.0.10.0/21', nil, nil, @network_interface_id).body
|
92
|
+
end
|
93
|
+
|
94
|
+
# Tests describe_route_tables
|
95
|
+
# - no parameters
|
96
|
+
# - filter: vpc-id => vpc_id
|
97
|
+
# - filter: vpc-id => ['all']
|
98
|
+
#
|
99
|
+
tests('#describe_route_tables').formats(@route_tables_format) do
|
100
|
+
Fog::Compute[:aws].describe_route_tables.body
|
101
|
+
end
|
102
|
+
tests("#describe_route_tables('vpc-id' => #{vpc.id})").formats(@route_tables_format) do
|
103
|
+
Fog::Compute[:aws].describe_route_tables('vpc-id' => vpc.id).body
|
104
|
+
end
|
105
|
+
tests("#describe_route_tables('vpc-id' => ['all'])").formats(@route_tables_format) do
|
106
|
+
Fog::Compute[:aws].describe_route_tables('vpc-id' => ['all']).body
|
107
|
+
end
|
108
|
+
|
109
|
+
# Test delete_route(route_table_id, cidr_block)
|
110
|
+
#
|
111
|
+
tests("#delete_route('#{@route_table_id}', '10.0.10.0/21')").formats(AWS::Compute::Formats::BASIC) do
|
112
|
+
Fog::Compute[:aws].delete_route(@route_table_id, '10.0.10.0/21').body
|
113
|
+
end
|
114
|
+
tests("#delete_route('#{@route_table_id}', '10.0.10.0/22')").formats(AWS::Compute::Formats::BASIC) do
|
115
|
+
Fog::Compute[:aws].delete_route(@route_table_id, '10.0.10.0/22').body
|
116
|
+
end
|
117
|
+
|
118
|
+
Fog::Compute[:aws].servers.all('instance-id'=>instance.id).first.destroy
|
119
|
+
if !Fog.mocking?
|
120
|
+
instance.wait_for { state.eql? "terminated" }
|
121
|
+
end
|
122
|
+
tests("#delete_route('#{@route_table_id}', '#{@destination_cidr_block}')").formats(AWS::Compute::Formats::BASIC) do
|
123
|
+
Fog::Compute[:aws].delete_route(@route_table_id, @destination_cidr_block).body
|
124
|
+
end
|
125
|
+
|
126
|
+
# Test disassociate_route_table(association_id)
|
127
|
+
#
|
128
|
+
tests("#disassociate_route_table('#{@association_id}')").formats(AWS::Compute::Formats::BASIC) do
|
129
|
+
Fog::Compute[:aws].disassociate_route_table(@association_id).body
|
130
|
+
end
|
131
|
+
|
132
|
+
# Test delete_route_table(route_table_id)
|
133
|
+
#
|
134
|
+
tests("#delete_route_table('#{@route_table_id}')").formats(AWS::Compute::Formats::BASIC) do
|
135
|
+
Fog::Compute[:aws].delete_route_table(@route_table_id).body
|
136
|
+
end
|
137
|
+
end
|
138
|
+
tests('failure') do
|
139
|
+
|
140
|
+
@route_table_id = Fog::Compute[:aws].create_route_table(vpc.id).body['routeTable'].first['routeTableId']
|
141
|
+
@association_id = Fog::Compute[:aws].associate_route_table(@route_table_id, @subnet_id).body['associationId']
|
142
|
+
Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, @internet_gateway_id, nil)
|
143
|
+
instance = Fog::Compute[:aws].servers.create(:image_id => @ami, :flavor_id => 't1.micro', :key_name => 'fog-test-key', :subnet_id => @subnet_id)
|
144
|
+
instance.wait_for { state.eql? "running" }
|
145
|
+
|
146
|
+
# Tests create_route_table
|
147
|
+
# - no parameters
|
148
|
+
# - passing a nonexisting vpc
|
149
|
+
#
|
150
|
+
tests('#create_route_table').raises(ArgumentError) do
|
151
|
+
Fog::Compute[:aws].create_route_table
|
152
|
+
end
|
153
|
+
tests("#create_route_table('vpc-00000000')").raises(Fog::Compute::AWS::NotFound) do
|
154
|
+
Fog::Compute[:aws].create_route_table('vpc-00000000')
|
155
|
+
end
|
156
|
+
|
157
|
+
# Tests associate_route_table
|
158
|
+
# - no parameters
|
159
|
+
# - passing a nonexisiting route table
|
160
|
+
# - passing a nonexisiting subnet
|
161
|
+
#
|
162
|
+
tests('#associate_route_table').raises(ArgumentError) do
|
163
|
+
Fog::Compute[:aws].associate_route_table
|
164
|
+
end
|
165
|
+
tests("#associate_route_table('rtb-00000000', '#{@subnet_id}')").raises(Fog::Compute::AWS::NotFound) do
|
166
|
+
Fog::Compute[:aws].associate_route_table('rtb-00000000', @subnet_id)
|
167
|
+
end
|
168
|
+
tests("#associate_route_table('#{@route_table_id}', 'subnet-00000000')").raises(Fog::Compute::AWS::NotFound) do
|
169
|
+
Fog::Compute[:aws].associate_route_table(@route_table_id, 'subnet-00000000')
|
170
|
+
end
|
171
|
+
|
172
|
+
# Tests create_route
|
173
|
+
# - no parameters
|
174
|
+
# - passing a nonexisiting route table and an exisiting internet gateway
|
175
|
+
# - passing a nonexisiting internet gateway
|
176
|
+
# - passing a nonexisting route table and an exisiting instance
|
177
|
+
# - passing a nonexisiting instance
|
178
|
+
# - passing a nonexsiting route table and an exisiting network interface
|
179
|
+
# - passing a nonexisiting network interface
|
180
|
+
# - attempting to add a route at the same destination cidr block as another
|
181
|
+
# - attempting to add a route at a less specific destination cidr block
|
182
|
+
#
|
183
|
+
tests('#create_route').raises(ArgumentError) do
|
184
|
+
Fog::Compute[:aws].create_route
|
185
|
+
end
|
186
|
+
tests("#create_route('rtb-00000000', '#{@destination_cidr_block}', '#{@internet_gateway_id}')").raises(Fog::Compute::AWS::NotFound) do
|
187
|
+
Fog::Compute[:aws].create_route('rtb-00000000', @destination_cidr_block, @internet_gateway_id)
|
188
|
+
end
|
189
|
+
tests("#create_route('#{@route_table_id}', '#{@destination_cidr_block}', 'igw-00000000')").raises(Fog::Compute::AWS::NotFound) do
|
190
|
+
Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, 'igw-00000000')
|
191
|
+
end
|
192
|
+
tests("#create_route('rtb-00000000', '#{@destination_cidr_block}', 'nil', '#{instance.id}')").raises(Fog::Compute::AWS::NotFound) do
|
193
|
+
Fog::Compute[:aws].create_route('rtb-00000000', @destination_cidr_block, instance.id)
|
194
|
+
end
|
195
|
+
tests("#create_route('#{@route_table_id}', '#{@destination_cidr_block}', 'nil', 'i-00000000')").raises(Fog::Compute::AWS::NotFound) do
|
196
|
+
Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, nil, 'i-00000000')
|
197
|
+
end
|
198
|
+
tests("#create_route('#{@route_table_id}', '#{@destinationCidrBlock}', 'nil', 'nil', 'eni-00000000')").raises(Fog::Compute::AWS::NotFound) do
|
199
|
+
Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, nil, nil, 'eni-00000000')
|
200
|
+
end
|
201
|
+
tests("#create_route('#rtb-00000000', '#{@destination_cidr_block}', 'nil, 'nil', '#{@network_interface_id}')").raises(Fog::Compute::AWS::NotFound) do
|
202
|
+
Fog::Compute[:aws].create_route('rtb-00000000', @destination_cidr_block, nil, nil, @network_interface_id)
|
203
|
+
end
|
204
|
+
tests("#create_route same destination_cidr_block").raises(Fog::Compute::AWS::Error) do
|
205
|
+
Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, @internet_gateway_id)
|
206
|
+
Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, nil, nil, @network_interface_id).body
|
207
|
+
end
|
208
|
+
if !Fog.mocking?
|
209
|
+
tests("#create_route less specific destination_cidr_block").raises(Fog::Compute::AWS::Error) do
|
210
|
+
Fog::Compute[:aws].create_route(@route_table_id, '10.0.10.0/25', @internet_gateway_id)
|
211
|
+
Fog::Compute[:aws].delete_route(@route_table_id, @destination_cidr_block).body
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
# Test describe_route_tables
|
216
|
+
# - passing a nonexisiting vpc
|
217
|
+
#
|
218
|
+
tests("#describe_route_tables('vpc-id' => 'vpc-00000000").formats({'routeTableSet'=>Array, 'requestId'=>String}) do
|
219
|
+
Fog::Compute[:aws].describe_route_tables('vpc-id' => 'vpc-00000000').body
|
220
|
+
end
|
221
|
+
|
222
|
+
# Tests delete_route
|
223
|
+
# - no parameters
|
224
|
+
# - passing a nonexisiting route table
|
225
|
+
#
|
226
|
+
tests('#delete_route').raises(ArgumentError) do
|
227
|
+
Fog::Compute[:aws].delete_route
|
228
|
+
end
|
229
|
+
tests("#delete_route('rtb-00000000', '#{@destination_cidr_block}')").raises(Fog::Compute::AWS::NotFound) do
|
230
|
+
Fog::Compute[:aws].delete_route('rtb-00000000', @destination_cidr_block)
|
231
|
+
end
|
232
|
+
|
233
|
+
# Tests disassociate_route_table
|
234
|
+
# - no parameters
|
235
|
+
# - passing a nonexisiting route table association id
|
236
|
+
#
|
237
|
+
tests('#disassociate_route_table').raises(ArgumentError) do
|
238
|
+
Fog::Compute[:aws].disassociate_route_table
|
239
|
+
end
|
240
|
+
tests("#disassociate_route_table('rtbassoc-00000000')").raises(Fog::Compute::AWS::NotFound) do
|
241
|
+
Fog::Compute[:aws].disassociate_route_table('rtbassoc-00000000')
|
242
|
+
end
|
243
|
+
|
244
|
+
# Tests delete_route_table
|
245
|
+
# - no parameters
|
246
|
+
# - passing a nonexisiting route table
|
247
|
+
#
|
248
|
+
tests('#delete_route_table').raises(ArgumentError) do
|
249
|
+
Fog::Compute[:aws].delete_route_table
|
250
|
+
end
|
251
|
+
tests("#delete_route_table('rtb-00000000')").raises(Fog::Compute::AWS::NotFound) do
|
252
|
+
Fog::Compute[:aws].delete_route_table('rtb-00000000')
|
253
|
+
end
|
254
|
+
|
255
|
+
# Dependency Tests
|
256
|
+
# - route is depending on route_table, so route_table cannot be deleted
|
257
|
+
#
|
258
|
+
tests("#delete_route_table('#{@route_table_id}')").raises(Fog::Compute::AWS::Error) do
|
259
|
+
Fog::Compute[:aws].delete_route_table(@route_table_id)
|
260
|
+
end
|
261
|
+
|
262
|
+
Fog::Compute[:aws].servers.all('instance-id'=>instance.id).first.destroy
|
263
|
+
if !Fog.mocking?
|
264
|
+
instance.wait_for { state.eql? "terminated" }
|
265
|
+
end
|
266
|
+
Fog::Compute[:aws].delete_route(@route_table_id, @destination_cidr_block)
|
267
|
+
Fog::Compute[:aws].disassociate_route_table(@association_id)
|
268
|
+
Fog::Compute[:aws].delete_route_table(@route_table_id)
|
269
|
+
end
|
270
|
+
|
271
|
+
Fog::Compute[:aws].delete_network_interface(@network_interface_id)
|
272
|
+
Fog::Compute[:aws].detach_internet_gateway(@internet_gateway_id, vpc.id)
|
273
|
+
Fog::Compute[:aws].delete_internet_gateway(@internet_gateway_id)
|
274
|
+
Fog::Compute[:aws].delete_subnet(@subnet_id)
|
275
|
+
vpc.destroy
|
276
|
+
key.destroy
|
277
|
+
end
|
@@ -8,6 +8,11 @@ class AWS
|
|
8
8
|
'ResponseMetadata' => {'RequestId' => String}
|
9
9
|
}
|
10
10
|
|
11
|
+
DB_AVAILABILITY_ZONE_OPTION = {
|
12
|
+
'Name' => String,
|
13
|
+
'ProvisionedIopsCapable' => Fog::Boolean
|
14
|
+
}
|
15
|
+
|
11
16
|
DB_PARAMETER_GROUP = {
|
12
17
|
'DBParameterGroupFamily' => String,
|
13
18
|
'DBParameterGroupName'=> String,
|
@@ -79,6 +84,23 @@ class AWS
|
|
79
84
|
}
|
80
85
|
}
|
81
86
|
|
87
|
+
ORDERABLE_DB_INSTANCE_OPTION = {
|
88
|
+
'MultiAZCapable' => Fog::Boolean,
|
89
|
+
'Engine' => String,
|
90
|
+
'LicenseModel' => String,
|
91
|
+
'ReadReplicaCapable' => Fog::Boolean,
|
92
|
+
'EngineVersion' => String,
|
93
|
+
'AvailabilityZones' => [DB_AVAILABILITY_ZONE_OPTION],
|
94
|
+
'DBInstanceClass' => String,
|
95
|
+
'Vpc' => Fog::Boolean
|
96
|
+
}
|
97
|
+
|
98
|
+
DESCRIBE_ORDERABLE_DB_INSTANCE_OPTION = BASIC.merge({
|
99
|
+
'DescribeOrderableDBInstanceOptionsResult' =>{
|
100
|
+
'OrderableDBInstanceOptions' => [ORDERABLE_DB_INSTANCE_OPTION]
|
101
|
+
}
|
102
|
+
})
|
103
|
+
|
82
104
|
MODIFY_PARAMETER_GROUP = BASIC.merge({
|
83
105
|
'ModifyDBParameterGroupResult' => {
|
84
106
|
'DBParameterGroupName' => String
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Shindo.tests('AWS::RDS | db instance option requests', ['aws', 'rds']) do
|
2
|
+
tests('success') do
|
3
|
+
|
4
|
+
tests("#describe_orderable_db_instance_options('mysql)").formats(AWS::RDS::Formats::DESCRIBE_ORDERABLE_DB_INSTANCE_OPTION) do
|
5
|
+
|
6
|
+
body = Fog::AWS[:rds].describe_orderable_db_instance_options('mysql').body
|
7
|
+
|
8
|
+
returns(2) {body['DescribeOrderableDBInstanceOptionsResult']['OrderableDBInstanceOptions'].length}
|
9
|
+
|
10
|
+
group = body['DescribeOrderableDBInstanceOptionsResult']['OrderableDBInstanceOptions'].first
|
11
|
+
returns( true ) { group['MultiAZCapable'] }
|
12
|
+
returns( 'mysql' ) { group['Engine'] }
|
13
|
+
returns( true ) { group['ReadReplicaCapable'] }
|
14
|
+
returns( true ) { group['AvailabilityZones'].length >= 1 }
|
15
|
+
|
16
|
+
body
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -63,4 +63,25 @@ Shindo.tests do
|
|
63
63
|
Fog.credentials_path
|
64
64
|
}
|
65
65
|
end
|
66
|
+
|
67
|
+
tests('symbolize_credential?') do
|
68
|
+
returns(true, "username") { Fog.symbolize_credential?(:username) }
|
69
|
+
returns(false, "headers") { Fog.symbolize_credential?(:headers) }
|
70
|
+
end
|
71
|
+
|
72
|
+
tests('symbolize_credentials') do
|
73
|
+
h = {
|
74
|
+
"a" => 3,
|
75
|
+
:something => 2,
|
76
|
+
"connection_options" => {"val" => 5},
|
77
|
+
:headers => { 'User-Agent' => "my user agent" }
|
78
|
+
}
|
79
|
+
|
80
|
+
returns({
|
81
|
+
:a => 3,
|
82
|
+
:something => 2,
|
83
|
+
:connection_options => {:val => 5},
|
84
|
+
:headers => { 'User-Agent' => "my user agent" }
|
85
|
+
}) { Fog.symbolize_credentials h }
|
86
|
+
end
|
66
87
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Shindo.tests('Fog::Service', ['core']) do
|
2
|
+
|
3
|
+
class TestService < Fog::Service
|
4
|
+
recognizes :generic_user, :generic_api_key
|
5
|
+
|
6
|
+
class Real
|
7
|
+
attr_reader :options
|
8
|
+
|
9
|
+
def initialize(opts={})
|
10
|
+
@options = opts
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Mock < Real
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
tests('Properly passes headers') do
|
19
|
+
user_agent = 'Generic Fog Client'
|
20
|
+
params = { :generic_user => "bob", :generic_api_key => '1234', :connection_options => {:headers => { 'User-Agent' => user_agent }}}
|
21
|
+
service = TestService.new(params)
|
22
|
+
|
23
|
+
returns('User-Agent' => user_agent) { service.options[:connection_options][:headers] }
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -134,6 +134,28 @@ Shindo.tests('OpenStack | authenticate', ['openstack']) do
|
|
134
134
|
|
135
135
|
end
|
136
136
|
|
137
|
+
tests("legacy v1 auth") do
|
138
|
+
headers = {
|
139
|
+
"X-Storage-Url" => "https://swift.myhost.com/v1/AUTH_tenant",
|
140
|
+
"X-Auth-Token" => "AUTH_yui193bdc00c1c46c5858788yuio0e1e2p",
|
141
|
+
"X-Trans-Id" => "iu99nm9999f9b999c9b999dad9cd999e99",
|
142
|
+
"Content-Length" => "0",
|
143
|
+
"Date" => "Wed, 07 Aug 2013 11:11:11 GMT"
|
144
|
+
}
|
145
|
+
|
146
|
+
Excon.stub({:method => 'GET', :path => "/auth/v1.0"},
|
147
|
+
{:status => 200, :body => "", :headers => headers})
|
148
|
+
|
149
|
+
returns("https://swift.myhost.com/v1/AUTH_tenant") do
|
150
|
+
Fog::OpenStack.authenticate_v1(
|
151
|
+
:openstack_auth_uri => URI('https://swift.myhost.com/auth/v1.0'),
|
152
|
+
:openstack_username => 'tenant:dev',
|
153
|
+
:openstack_api_key => 'secret_key',
|
154
|
+
:openstack_service_type => %w[storage])[:server_management_url]
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
|
137
159
|
ensure
|
138
160
|
Excon.stubs.clear
|
139
161
|
Excon.defaults[:mock] = @old_mock_value
|
@@ -2,6 +2,10 @@ Shindo.tests('Fog::OpenStack::Storage | file', ['openstack']) do
|
|
2
2
|
|
3
3
|
pending if Fog.mocking?
|
4
4
|
|
5
|
+
def object_attributes(file=@instance)
|
6
|
+
@instance.service.head_object(@directory.key, file.key).headers
|
7
|
+
end
|
8
|
+
|
5
9
|
def object_meta_attributes
|
6
10
|
@instance.service.head_object(@directory.key, @instance.key).headers.reject {|k, v| !(k =~ /X-Object-Meta-/)}
|
7
11
|
end
|
@@ -67,7 +71,22 @@ Shindo.tests('Fog::OpenStack::Storage | file', ['openstack']) do
|
|
67
71
|
end
|
68
72
|
|
69
73
|
end
|
70
|
-
|
74
|
+
|
75
|
+
tests('#content_disposition') do
|
76
|
+
before do
|
77
|
+
@instance = @directory.files.create :key => 'meta-test', :body => lorem_file, :content_disposition => 'ho-ho-ho'
|
78
|
+
end
|
79
|
+
|
80
|
+
after do
|
81
|
+
clear_metadata
|
82
|
+
@instance.save
|
83
|
+
end
|
84
|
+
|
85
|
+
tests("sets Content-Disposition on create").returns("ho-ho-ho") do
|
86
|
+
object_attributes(@instance)["Content-Disposition"]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
71
90
|
tests('#metadata keys') do
|
72
91
|
|
73
92
|
after do
|
@@ -16,37 +16,37 @@ Shindo.tests('Fog::Compute[:openstack] | flavor requests', ['openstack']) do
|
|
16
16
|
|
17
17
|
tests('success') do
|
18
18
|
|
19
|
-
tests('#get_flavor_details(1)').
|
19
|
+
tests('#get_flavor_details(1)').data_matches_schema(@flavor_format) do
|
20
20
|
Fog::Compute[:openstack].get_flavor_details("1").body['flavor']
|
21
21
|
end
|
22
22
|
|
23
|
-
tests('#list_flavors').
|
23
|
+
tests('#list_flavors').data_matches_schema({'flavors' => [OpenStack::Compute::Formats::SUMMARY]}) do
|
24
24
|
Fog::Compute[:openstack].list_flavors.body
|
25
25
|
end
|
26
26
|
|
27
|
-
tests('#list_flavors_detail').
|
27
|
+
tests('#list_flavors_detail').data_matches_schema({'flavors' => [@flavor_format]}) do
|
28
28
|
Fog::Compute[:openstack].list_flavors_detail.body
|
29
29
|
end
|
30
30
|
|
31
|
-
tests('#create_flavor(attributes)').
|
31
|
+
tests('#create_flavor(attributes)').data_matches_schema({'flavor' => @flavor_format}) do
|
32
32
|
attributes = {:flavor_id => '100', :name => 'shindo test flavor', :disk => 10, :ram => 10, :vcpus => 10, :swap => "0", :rxtx_factor => 2.4, :ephemeral => 0, :is_public => false}
|
33
33
|
Fog::Compute[:openstack].create_flavor(attributes).body
|
34
34
|
end
|
35
35
|
|
36
|
-
tests('
|
37
|
-
Fog::Compute[:openstack].
|
36
|
+
tests('add_flavor_access(flavor_ref, tenant_id)').data_matches_schema({'flavor_access' => [{'tenant_id' => String, 'flavor_id' => String}]}) do
|
37
|
+
Fog::Compute[:openstack].add_flavor_access(100, 1).body
|
38
38
|
end
|
39
39
|
|
40
|
-
tests('
|
41
|
-
Fog::Compute[:openstack].
|
40
|
+
tests('remove_flavor_access(flavor_ref, tenant_id)').data_matches_schema({'flavor_access' => []}) do
|
41
|
+
Fog::Compute[:openstack].remove_flavor_access(100, 1).body
|
42
42
|
end
|
43
43
|
|
44
|
-
tests('
|
45
|
-
Fog::Compute[:openstack].
|
44
|
+
tests('list_tenants_with_flavor_access(flavor_ref)').data_matches_schema({'flavor_access' => [{'tenant_id' => String, 'flavor_id' => String}]}) do
|
45
|
+
Fog::Compute[:openstack].list_tenants_with_flavor_access(100).body
|
46
46
|
end
|
47
47
|
|
48
|
-
tests('
|
49
|
-
Fog::Compute[:openstack].
|
48
|
+
tests('delete_flavor(flavor_id)').succeeds do
|
49
|
+
Fog::Compute[:openstack].delete_flavor('100')
|
50
50
|
end
|
51
51
|
|
52
52
|
end
|
@@ -57,6 +57,21 @@ Shindo.tests('Fog::Compute[:openstack] | flavor requests', ['openstack']) do
|
|
57
57
|
Fog::Compute[:openstack].get_flavor_details("0")
|
58
58
|
end
|
59
59
|
|
60
|
+
tests('add_flavor_access(1234, 1)').raises(Fog::Compute::OpenStack::NotFound) do
|
61
|
+
pending if Fog.mocking?
|
62
|
+
Fog::Compute[:openstack].add_flavor_access(1234, 1).body
|
63
|
+
end
|
64
|
+
|
65
|
+
tests('remove_flavor_access(1234, 1)').raises(Fog::Compute::OpenStack::NotFound) do
|
66
|
+
pending if Fog.mocking?
|
67
|
+
Fog::Compute[:openstack].remove_flavor_access(1234, 1).body
|
68
|
+
end
|
69
|
+
|
70
|
+
tests('list_tenants_with_flavor_access(1234)').raises(Fog::Compute::OpenStack::NotFound) do
|
71
|
+
pending if Fog.mocking?
|
72
|
+
Fog::Compute[:openstack].list_tenants_with_flavor_access(1234)
|
73
|
+
end
|
74
|
+
|
60
75
|
end
|
61
76
|
|
62
77
|
end
|