mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[brightbox] Dynamically select testing image
This commit is contained in:
parent
e073fcffb4
commit
75f53bd6a9
4 changed files with 14 additions and 4 deletions
|
@ -32,7 +32,17 @@ NilClass.send :include, Fog::Brightbox::Nullable::Zone
|
|||
class Brightbox
|
||||
module Compute
|
||||
module TestSupport
|
||||
IMAGE_IDENTIFER = "img-2ab98" # Ubuntu Lucid 10.04 server (i686)
|
||||
# Find a suitable image for testing with
|
||||
# For speed of server building we're using an empty image
|
||||
def self.image_id
|
||||
return @image_id unless @image_id.nil?
|
||||
images = Fog::Compute[:brightbox].list_images
|
||||
raise "No available images!" if images.empty?
|
||||
image = images.select {|img| img.size == 0 }.first
|
||||
image = images.first if image.nil?
|
||||
@image_id = image["id"]
|
||||
end
|
||||
|
||||
end
|
||||
module Formats
|
||||
module Struct
|
||||
|
|
|
@ -3,7 +3,7 @@ Shindo.tests('Fog::Compute[:brightbox] | load balancer requests', ['brightbox'])
|
|||
tests('success') do
|
||||
|
||||
unless Fog.mocking?
|
||||
@node = Fog::Compute[:brightbox].servers.create(:image_id => Brightbox::Compute::TestSupport::IMAGE_IDENTIFER)
|
||||
@node = Fog::Compute[:brightbox].servers.create(:image_id => Brightbox::Compute::TestSupport.image_id)
|
||||
node_id = @node.id
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ Shindo.tests('Fog::Compute[:brightbox] | server group requests', ['brightbox'])
|
|||
tests('success') do
|
||||
|
||||
unless Fog.mocking?
|
||||
@server = Fog::Compute[:brightbox].servers.create(:image_id => Brightbox::Compute::TestSupport::IMAGE_IDENTIFER)
|
||||
@server = Fog::Compute[:brightbox].servers.create(:image_id => Brightbox::Compute::TestSupport.image_id)
|
||||
server_id = @server.id
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ Shindo.tests('Fog::Compute[:brightbox] | server requests', ['brightbox']) do
|
|||
|
||||
tests('success') do
|
||||
|
||||
image_id = Brightbox::Compute::TestSupport::IMAGE_IDENTIFER
|
||||
image_id = Brightbox::Compute::TestSupport.image_id
|
||||
server_id = nil
|
||||
|
||||
tests("#create_server(:image => '#{image_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do
|
||||
|
|
Loading…
Add table
Reference in a new issue