fog 1.33.0 → 1.34.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +47 -0
- data/Rakefile +3 -0
- data/fog.gemspec +4 -4
- data/lib/fog/openstack/baremetal.rb +20 -82
- data/lib/fog/openstack/compute.rb +11 -34
- data/lib/fog/openstack/core.rb +37 -10
- data/lib/fog/openstack/identity.rb +33 -44
- data/lib/fog/openstack/identity_v2.rb +14 -84
- data/lib/fog/openstack/identity_v3.rb +4 -51
- data/lib/fog/openstack/image.rb +22 -83
- data/lib/fog/openstack/metering.rb +15 -76
- data/lib/fog/openstack/models/compute/server.rb +1 -1
- data/lib/fog/openstack/models/orchestration/events.rb +1 -0
- data/lib/fog/openstack/models/orchestration/resources.rb +1 -0
- data/lib/fog/openstack/models/orchestration/stack.rb +1 -1
- data/lib/fog/openstack/models/orchestration/stacks.rb +1 -0
- data/lib/fog/openstack/models/orchestration/templates.rb +1 -0
- data/lib/fog/openstack/network.rb +21 -21
- data/lib/fog/openstack/orchestration.rb +11 -91
- data/lib/fog/openstack/planning.rb +19 -81
- data/lib/fog/openstack/requests/compute/list_security_groups.rb +9 -1
- data/lib/fog/openstack/requests/network/add_router_interface.rb +12 -4
- data/lib/fog/openstack/requests/network/create_port.rb +14 -12
- data/lib/fog/openstack/requests/network/get_port.rb +4 -0
- data/lib/fog/openstack/requests/network/set_tenant.rb +1 -0
- data/lib/fog/openstack/storage.rb +18 -57
- data/lib/fog/openstack/volume.rb +17 -79
- data/lib/fog/rackspace/requests/storage/get_object_https_url.rb +13 -2
- data/lib/fog/vcloud_director/generators/compute/edge_gateway_service_configuration.rb +7 -6
- data/lib/fog/vcloud_director/models/compute/vm_customizations.rb +15 -0
- data/lib/fog/version.rb +1 -1
- data/lib/tasks/changelog_task.rb +1 -0
- data/spec/fog/openstack/volume_spec.rb +5 -0
- data/tests/compute/helper.rb +0 -6
- data/tests/openstack/requests/network/port_tests.rb +14 -12
- data/tests/rackspace/requests/storage/object_tests.rb +46 -4
- data/tests/vcloud_director/requests/compute/edge_gateway_tests.rb +2 -2
- metadata +11 -74
- data/lib/fog/bin/dynect.rb +0 -28
- data/tests/brightbox/compute/helper.rb +0 -1
- data/tests/brightbox/compute/schema.rb +0 -799
- data/tests/brightbox/compute_tests.rb +0 -101
- data/tests/brightbox/helper.rb +0 -1
- data/tests/brightbox/models/compute/account_tests.rb +0 -17
- data/tests/brightbox/models/compute/cloud_ip_tests.rb +0 -32
- data/tests/brightbox/models/compute/database_server_tests.rb +0 -78
- data/tests/brightbox/models/compute/database_snapshot_tests.rb +0 -26
- data/tests/brightbox/models/compute/database_type_tests.rb +0 -27
- data/tests/brightbox/models/compute/server_tests.rb +0 -19
- data/tests/brightbox/oauth2_tests.rb +0 -110
- data/tests/brightbox/requests/compute/account_tests.rb +0 -65
- data/tests/brightbox/requests/compute/api_client_tests.rb +0 -64
- data/tests/brightbox/requests/compute/application_test.rb +0 -63
- data/tests/brightbox/requests/compute/cloud_ip_tests.rb +0 -85
- data/tests/brightbox/requests/compute/collaboration_tests.rb +0 -39
- data/tests/brightbox/requests/compute/database_server_tests.rb +0 -54
- data/tests/brightbox/requests/compute/database_snapsnot_tests.rb +0 -47
- data/tests/brightbox/requests/compute/database_type_tests.rb +0 -17
- data/tests/brightbox/requests/compute/firewall_policy_tests.rb +0 -40
- data/tests/brightbox/requests/compute/firewall_rule_tests.rb +0 -43
- data/tests/brightbox/requests/compute/helper.rb +0 -41
- data/tests/brightbox/requests/compute/image_tests.rb +0 -60
- data/tests/brightbox/requests/compute/interface_tests.rb +0 -33
- data/tests/brightbox/requests/compute/load_balancer_tests.rb +0 -121
- data/tests/brightbox/requests/compute/server_group_tests.rb +0 -96
- data/tests/brightbox/requests/compute/server_tests.rb +0 -99
- data/tests/brightbox/requests/compute/server_type_tests.rb +0 -34
- data/tests/brightbox/requests/compute/user_collaboration_tests.rb +0 -67
- data/tests/brightbox/requests/compute/user_tests.rb +0 -38
- data/tests/brightbox/requests/compute/zone_tests.rb +0 -34
@@ -1,41 +0,0 @@
|
|
1
|
-
class Brightbox
|
2
|
-
module Compute
|
3
|
-
module TestSupport
|
4
|
-
# Find a suitable image for testing with
|
5
|
-
# For speed of server building we're using an empty image
|
6
|
-
#
|
7
|
-
# Unless the tester has credentials this will fail so we rescue
|
8
|
-
# any errors and return nil.
|
9
|
-
#
|
10
|
-
# This is used in the shared file +tests/compute/helper.rb+ so unfortunately
|
11
|
-
# makes all tests reliant on hardcoded values and each other
|
12
|
-
#
|
13
|
-
# @return [String,NilClass] the most suitable test image's identifier or nil
|
14
|
-
def self.image_id
|
15
|
-
return @image_id unless @image_id.nil?
|
16
|
-
image = select_testing_image_from_api
|
17
|
-
@image_id = image["id"]
|
18
|
-
rescue
|
19
|
-
@image_id = nil
|
20
|
-
end
|
21
|
-
|
22
|
-
# Prepare a test server, wait for it to be usable but raise if it fails
|
23
|
-
def self.get_test_server
|
24
|
-
test_server_options = {:image_id => image_id}
|
25
|
-
server = Fog::Compute[:brightbox].servers.create(test_server_options)
|
26
|
-
server.wait_for {
|
27
|
-
raise "Test server failed to build" if state == "failed"
|
28
|
-
ready?
|
29
|
-
}
|
30
|
-
server
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
def self.select_testing_image_from_api
|
35
|
-
images = Fog::Compute[:brightbox].list_images
|
36
|
-
raise "No available images!" if images.empty?
|
37
|
-
images.select { |img| img["official"] && img["virtual_size"] != 0 }.sort_by { |img| img["disk_size"] }.first || images.first
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:brightbox] | image requests', ['brightbox']) do
|
2
|
-
|
3
|
-
tests('success') do
|
4
|
-
|
5
|
-
## Difficult to test without having uploaded an Image to your account to register
|
6
|
-
# creation_options = {
|
7
|
-
# "arch" => "i686",
|
8
|
-
# "source" => "fnord"
|
9
|
-
# }
|
10
|
-
# tests("#create_image(#{creation_options.inspect})")
|
11
|
-
# result = Fog::Compute[:brightbox].create_image(creation_options)
|
12
|
-
# @image_id = result["id"]
|
13
|
-
# formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
|
14
|
-
# end
|
15
|
-
|
16
|
-
# Fog::Compute[:brightbox].images.get(@image_id).wait_for { ready? }
|
17
|
-
|
18
|
-
tests("#list_images") do
|
19
|
-
pending if Fog.mocking?
|
20
|
-
result = Fog::Compute[:brightbox].list_images
|
21
|
-
@image_id = result.first["id"]
|
22
|
-
data_matches_schema(Brightbox::Compute::Formats::Collection::IMAGES, {:allow_extra_keys => true}) { result }
|
23
|
-
end
|
24
|
-
|
25
|
-
tests("#get_image('#{@image_id}')") do
|
26
|
-
pending if Fog.mocking?
|
27
|
-
result = Fog::Compute[:brightbox].get_image(@image_id)
|
28
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::IMAGE, {:allow_extra_keys => true}) { result }
|
29
|
-
end
|
30
|
-
|
31
|
-
## Until Image creation can be automated, we shouldn't be updating Images randomly
|
32
|
-
# update_options = {}
|
33
|
-
# tests("#update_image('#{@image_id}', #{update_options.inspect})") do
|
34
|
-
# result = Fog::Compute[:brightbox].update_image(@image_id, :name => "New name from Fog test")
|
35
|
-
# formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
|
36
|
-
# end
|
37
|
-
|
38
|
-
## Same as other tests - can't be deleting them unless part of the test run
|
39
|
-
# tests("#destroy_server('#{@image_id}')") do
|
40
|
-
# result = Fog::Compute[:brightbox].destroy_image(@image_id)
|
41
|
-
# formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
|
42
|
-
# end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
tests('failure') do
|
47
|
-
|
48
|
-
tests("#get_image('img-00000')").raises(Excon::Errors::NotFound) do
|
49
|
-
pending if Fog.mocking?
|
50
|
-
Fog::Compute[:brightbox].get_image('img-00000')
|
51
|
-
end
|
52
|
-
|
53
|
-
tests("#get_image").raises(ArgumentError) do
|
54
|
-
pending if Fog.mocking?
|
55
|
-
Fog::Compute[:brightbox].get_image
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:brightbox] | interface requests', ['brightbox']) do
|
2
|
-
|
3
|
-
@test_service = Fog::Compute[:brightbox]
|
4
|
-
|
5
|
-
tests('success') do
|
6
|
-
|
7
|
-
unless Fog.mocking?
|
8
|
-
@test_server = Brightbox::Compute::TestSupport.get_test_server
|
9
|
-
@interface_id = @test_server.interfaces.first["id"]
|
10
|
-
|
11
|
-
tests("#get_interface('#{@interface_id}')") do
|
12
|
-
pending if Fog.mocking?
|
13
|
-
result = @test_service.get_interface(@interface_id)
|
14
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::INTERFACE, {:allow_extra_keys => true}) { result }
|
15
|
-
end
|
16
|
-
|
17
|
-
@test_server.destroy
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
tests('failure') do
|
22
|
-
|
23
|
-
tests("#get_interface('int-00000')").raises(Excon::Errors::NotFound) do
|
24
|
-
pending if Fog.mocking?
|
25
|
-
@test_service.get_interface('int-00000')
|
26
|
-
end
|
27
|
-
|
28
|
-
tests("#get_interface()").raises(ArgumentError) do
|
29
|
-
pending if Fog.mocking?
|
30
|
-
@test_service.get_interface()
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,121 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:brightbox] | load balancer requests', ['brightbox']) do
|
2
|
-
|
3
|
-
tests('success') do
|
4
|
-
|
5
|
-
unless Fog.mocking?
|
6
|
-
@node = Brightbox::Compute::TestSupport.get_test_server
|
7
|
-
node_id = @node.id
|
8
|
-
end
|
9
|
-
|
10
|
-
create_options = {
|
11
|
-
:nodes => [{
|
12
|
-
:node => node_id
|
13
|
-
}],
|
14
|
-
:listeners => [{
|
15
|
-
:in => 80,
|
16
|
-
:out => 8080,
|
17
|
-
:protocol => "http"
|
18
|
-
}],
|
19
|
-
:healthcheck => {
|
20
|
-
:type => "http",
|
21
|
-
:port => 80
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
tests("#create_load_balancer(#{create_options.inspect})") do
|
26
|
-
pending if Fog.mocking?
|
27
|
-
result = Fog::Compute[:brightbox].create_load_balancer(create_options)
|
28
|
-
@load_balancer_id = result["id"]
|
29
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
|
30
|
-
end
|
31
|
-
|
32
|
-
unless Fog.mocking?
|
33
|
-
Fog::Compute[:brightbox].load_balancers.get(@load_balancer_id).wait_for { ready? }
|
34
|
-
end
|
35
|
-
|
36
|
-
tests("#list_load_balancers()") do
|
37
|
-
pending if Fog.mocking?
|
38
|
-
result = Fog::Compute[:brightbox].list_load_balancers
|
39
|
-
data_matches_schema(Brightbox::Compute::Formats::Collection::LOAD_BALANCERS, {:allow_extra_keys => true}) { result }
|
40
|
-
end
|
41
|
-
|
42
|
-
tests("#get_load_balancer('#{@load_balancer_id}')") do
|
43
|
-
pending if Fog.mocking?
|
44
|
-
result = Fog::Compute[:brightbox].get_load_balancer(@load_balancer_id)
|
45
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
|
46
|
-
end
|
47
|
-
|
48
|
-
update_options = {:name => "New name"}
|
49
|
-
tests("#update_load_balancer('#{@load_balancer_id}', #{update_options.inspect})") do
|
50
|
-
pending if Fog.mocking?
|
51
|
-
result = Fog::Compute[:brightbox].update_load_balancer(@load_balancer_id, update_options)
|
52
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
|
53
|
-
end
|
54
|
-
|
55
|
-
add_listeners_options = {:listeners=>[{:out=>28080, :in=>8080, :protocol=>"http"}]}
|
56
|
-
tests("#add_listeners_load_balancer('#{@load_balancer_id}', #{add_listeners_options.inspect})") do
|
57
|
-
pending if Fog.mocking?
|
58
|
-
result = Fog::Compute[:brightbox].add_listeners_load_balancer(@load_balancer_id, add_listeners_options)
|
59
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
|
60
|
-
end
|
61
|
-
|
62
|
-
remove_listeners_options = {:listeners=>[{:out=>28080, :in=>8080, :protocol=>"http"}]}
|
63
|
-
tests("#remove_listeners_load_balancer('#{@load_balancer_id}', #{remove_listeners_options.inspect})") do
|
64
|
-
pending if Fog.mocking?
|
65
|
-
result = Fog::Compute[:brightbox].remove_listeners_load_balancer(@load_balancer_id, remove_listeners_options)
|
66
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
|
67
|
-
end
|
68
|
-
|
69
|
-
unless Fog.mocking?
|
70
|
-
@node2 = Brightbox::Compute::TestSupport.get_test_server
|
71
|
-
second_node_id = @node2.id
|
72
|
-
end
|
73
|
-
|
74
|
-
# Can't remove the last node so we need to add a second...
|
75
|
-
add_nodes_options = {:nodes => [{:node => second_node_id}]}
|
76
|
-
tests("#add_nodes_load_balancer('#{@load_balancer_id}', #{add_nodes_options.inspect})") do
|
77
|
-
pending if Fog.mocking?
|
78
|
-
result = Fog::Compute[:brightbox].add_nodes_load_balancer(@load_balancer_id, add_nodes_options)
|
79
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
|
80
|
-
end
|
81
|
-
|
82
|
-
# ...before we can attempt to remove either
|
83
|
-
remove_nodes_options = {:nodes => [{:node => node_id}]}
|
84
|
-
tests("#remove_nodes_load_balancer('#{@load_balancer_id}', #{remove_nodes_options.inspect})") do
|
85
|
-
pending if Fog.mocking?
|
86
|
-
result = Fog::Compute[:brightbox].remove_nodes_load_balancer(@load_balancer_id, remove_nodes_options)
|
87
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
|
88
|
-
end
|
89
|
-
|
90
|
-
tests("#destroy_load_balancer('#{@load_balancer_id}')") do
|
91
|
-
pending if Fog.mocking?
|
92
|
-
result = Fog::Compute[:brightbox].destroy_load_balancer(@load_balancer_id)
|
93
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
|
94
|
-
end
|
95
|
-
|
96
|
-
unless Fog.mocking?
|
97
|
-
@node.destroy
|
98
|
-
@node2.destroy
|
99
|
-
end
|
100
|
-
|
101
|
-
end
|
102
|
-
|
103
|
-
tests('failure') do
|
104
|
-
|
105
|
-
tests("#create_load_balancer").raises(ArgumentError) do
|
106
|
-
pending if Fog.mocking?
|
107
|
-
Fog::Compute[:brightbox].create_load_balancer
|
108
|
-
end
|
109
|
-
|
110
|
-
tests("#get_load_balancer('lba-00000')").raises(Excon::Errors::NotFound) do
|
111
|
-
pending if Fog.mocking?
|
112
|
-
Fog::Compute[:brightbox].get_load_balancer('lba-00000')
|
113
|
-
end
|
114
|
-
|
115
|
-
tests("#get_load_balancer").raises(ArgumentError) do
|
116
|
-
pending if Fog.mocking?
|
117
|
-
Fog::Compute[:brightbox].get_load_balancer
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
end
|
@@ -1,96 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:brightbox] | server group requests', ['brightbox']) do
|
2
|
-
|
3
|
-
tests('success') do
|
4
|
-
|
5
|
-
unless Fog.mocking?
|
6
|
-
@server = Brightbox::Compute::TestSupport.get_test_server
|
7
|
-
server_id = @server.id
|
8
|
-
end
|
9
|
-
|
10
|
-
create_options = {
|
11
|
-
:name => "Fog@#{Time.now.iso8601}",
|
12
|
-
:servers => [{
|
13
|
-
:server => server_id
|
14
|
-
}]
|
15
|
-
}
|
16
|
-
|
17
|
-
tests("#create_server_group(#{create_options.inspect})") do
|
18
|
-
pending if Fog.mocking?
|
19
|
-
result = Fog::Compute[:brightbox].create_server_group(create_options)
|
20
|
-
@server_group_id = result["id"]
|
21
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
|
22
|
-
end
|
23
|
-
|
24
|
-
tests("#list_server_groups") do
|
25
|
-
pending if Fog.mocking?
|
26
|
-
result = Fog::Compute[:brightbox].list_server_groups
|
27
|
-
data_matches_schema(Brightbox::Compute::Formats::Collection::SERVER_GROUPS, {:allow_extra_keys => true}) { result }
|
28
|
-
@default_group_id = result.select {|grp| grp["default"] == true }.first["id"]
|
29
|
-
end
|
30
|
-
|
31
|
-
tests("#get_server_group('#{@server_group_id}')") do
|
32
|
-
pending if Fog.mocking?
|
33
|
-
result = Fog::Compute[:brightbox].get_server_group(@server_group_id)
|
34
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
|
35
|
-
end
|
36
|
-
|
37
|
-
update_options = {:name => "Fog@#{Time.now.iso8601}"}
|
38
|
-
tests("#update_server_group('#{@server_group_id}', #{update_options.inspect})") do
|
39
|
-
pending if Fog.mocking?
|
40
|
-
result = Fog::Compute[:brightbox].update_server_group(@server_group_id, update_options)
|
41
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
|
42
|
-
end
|
43
|
-
|
44
|
-
remove_options = {:servers => [{:server => server_id}]}
|
45
|
-
tests("#remove_servers_server_group('#{@server_group_id}', #{remove_options.inspect})") do
|
46
|
-
pending if Fog.mocking?
|
47
|
-
result = Fog::Compute[:brightbox].remove_servers_server_group(@server_group_id, remove_options)
|
48
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
|
49
|
-
end
|
50
|
-
|
51
|
-
add_options = {:servers => [{:server => server_id}]}
|
52
|
-
tests("#add_servers_server_group('#{@server_group_id}', #{remove_options.inspect})") do
|
53
|
-
pending if Fog.mocking?
|
54
|
-
result = Fog::Compute[:brightbox].add_servers_server_group(@server_group_id, add_options)
|
55
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
|
56
|
-
end
|
57
|
-
|
58
|
-
move_options = {:destination => @default_group_id, :servers => [{:server => server_id}]}
|
59
|
-
tests("#move_servers_server_group('#{@server_group_id}', #{move_options.inspect})") do
|
60
|
-
pending if Fog.mocking?
|
61
|
-
result = Fog::Compute[:brightbox].move_servers_server_group(@server_group_id, move_options)
|
62
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
|
63
|
-
test("group is emptied") { result["servers"].empty? }
|
64
|
-
end
|
65
|
-
|
66
|
-
tests("#destroy_server_group('#{@server_group_id}')") do
|
67
|
-
pending if Fog.mocking?
|
68
|
-
result = Fog::Compute[:brightbox].destroy_server_group(@server_group_id)
|
69
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
|
70
|
-
end
|
71
|
-
|
72
|
-
unless Fog.mocking?
|
73
|
-
@server.destroy
|
74
|
-
end
|
75
|
-
|
76
|
-
end
|
77
|
-
|
78
|
-
tests('failure') do
|
79
|
-
|
80
|
-
tests("#create_server_group").raises(ArgumentError) do
|
81
|
-
pending if Fog.mocking?
|
82
|
-
Fog::Compute[:brightbox].create_server_group
|
83
|
-
end
|
84
|
-
|
85
|
-
tests("#get_server_group('grp-00000')").raises(Excon::Errors::NotFound) do
|
86
|
-
pending if Fog.mocking?
|
87
|
-
Fog::Compute[:brightbox].get_server_group('grp-00000')
|
88
|
-
end
|
89
|
-
|
90
|
-
tests("#get_server_group").raises(ArgumentError) do
|
91
|
-
pending if Fog.mocking?
|
92
|
-
Fog::Compute[:brightbox].get_server_group
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
Shindo.tests('Fog::Compute[:brightbox] | server requests', ['brightbox']) do
|
2
|
-
|
3
|
-
tests('success') do
|
4
|
-
|
5
|
-
unless Fog.mocking?
|
6
|
-
image_id = Brightbox::Compute::TestSupport.image_id
|
7
|
-
server_id = nil
|
8
|
-
end
|
9
|
-
|
10
|
-
tests("#create_server(:image => '#{image_id}')") do
|
11
|
-
pending if Fog.mocking?
|
12
|
-
result = Fog::Compute[:brightbox].create_server(:image => image_id)
|
13
|
-
server_id = result["id"]
|
14
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
|
15
|
-
end
|
16
|
-
|
17
|
-
unless Fog.mocking?
|
18
|
-
Fog::Compute[:brightbox].servers.get(server_id).wait_for { ready? }
|
19
|
-
end
|
20
|
-
|
21
|
-
tests("#list_servers") do
|
22
|
-
pending if Fog.mocking?
|
23
|
-
result = Fog::Compute[:brightbox].list_servers
|
24
|
-
data_matches_schema(Brightbox::Compute::Formats::Collection::SERVERS, {:allow_extra_keys => true}) { result }
|
25
|
-
end
|
26
|
-
|
27
|
-
tests("#get_server('#{server_id}')") do
|
28
|
-
pending if Fog.mocking?
|
29
|
-
result = Fog::Compute[:brightbox].get_server(server_id)
|
30
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
|
31
|
-
end
|
32
|
-
|
33
|
-
tests("#update_server('#{server_id}')") do
|
34
|
-
pending if Fog.mocking?
|
35
|
-
result = Fog::Compute[:brightbox].update_server(server_id, :name => "Fog@#{Time.now.iso8601}")
|
36
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
|
37
|
-
end
|
38
|
-
|
39
|
-
tests("#activate_console_server('#{server_id}')") do
|
40
|
-
pending if Fog.mocking?
|
41
|
-
result = Fog::Compute[:brightbox].activate_console_server(server_id)
|
42
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
|
43
|
-
test("has set 'console_url'") { ! result["console_url"].empty? }
|
44
|
-
test("has set 'console_token'") { ! result["console_token"].empty? }
|
45
|
-
test("has set 'console_token_expires'") { ! result["console_token_expires"].empty? }
|
46
|
-
end
|
47
|
-
|
48
|
-
tests("#stop_server('#{server_id}')") do
|
49
|
-
pending if Fog.mocking?
|
50
|
-
result = Fog::Compute[:brightbox].stop_server(server_id)
|
51
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
|
52
|
-
end
|
53
|
-
|
54
|
-
tests("#start_server('#{server_id}')") do
|
55
|
-
pending if Fog.mocking?
|
56
|
-
result = Fog::Compute[:brightbox].start_server(server_id)
|
57
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
|
58
|
-
end
|
59
|
-
|
60
|
-
tests("#shutdown_server('#{server_id}')") do
|
61
|
-
pending if Fog.mocking?
|
62
|
-
result = Fog::Compute[:brightbox].shutdown_server(server_id)
|
63
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
|
64
|
-
end
|
65
|
-
|
66
|
-
tests("#snapshot_server('#{server_id}')") do
|
67
|
-
pending if Fog.mocking?
|
68
|
-
result = Fog::Compute[:brightbox].snapshot_server(server_id)
|
69
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
|
70
|
-
# Server should be exclusively for our test so assume we can delete the snapshot
|
71
|
-
snapshot_id = result["snapshots"].first["id"]
|
72
|
-
@snapshot = Fog::Compute[:brightbox].images.get(snapshot_id)
|
73
|
-
@snapshot.wait_for { ready? }
|
74
|
-
@snapshot.destroy
|
75
|
-
end
|
76
|
-
|
77
|
-
tests("#destroy_server('#{server_id}')") do
|
78
|
-
pending if Fog.mocking?
|
79
|
-
result = Fog::Compute[:brightbox].destroy_server(server_id)
|
80
|
-
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
84
|
-
|
85
|
-
tests('failure') do
|
86
|
-
|
87
|
-
tests("#get_server('srv-00000')").raises(Excon::Errors::NotFound) do
|
88
|
-
pending if Fog.mocking?
|
89
|
-
Fog::Compute[:brightbox].get_server('srv-00000')
|
90
|
-
end
|
91
|
-
|
92
|
-
tests("#get_server").raises(ArgumentError) do
|
93
|
-
pending if Fog.mocking?
|
94
|
-
Fog::Compute[:brightbox].get_server
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|