Permalink
Browse files

Add LB options to block creation

  • Loading branch information...
1 parent e2f5c29 commit d01faf71d7dcfad854b416cfd0aec843cd44b1ee @ggoodale committed Mar 13, 2011
View
@@ -0,0 +1,4 @@
+rvm_install_on_use_flag=1
+rvm_archflags="-arch x86_64"
+rvm 1.9.2@fog
+
@@ -20,6 +20,7 @@ class Server < Fog::Model
attribute :status
attribute :storage
attribute :template
+ attribute :lb_applications, :type => :array # The Load Balanced Application IDs for this block.
attr_accessor :password
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
@@ -23,7 +23,7 @@ def create_block(product_id, template_id, options = {})
:expects => 200,
:method => 'POST',
:path => '/api/blocks.json',
- :query => {'product' => product_id, 'template' => template_id}.merge!(options)
+ :query => query = {'product' => product_id, 'template' => template_id}.merge!(options)
)
end
@@ -1,25 +1,30 @@
Shindo.tests('Bluebox::Compute | block requests', ['bluebox']) do
@block_format = {
- 'cpu' => Float,
- 'description' => String,
- 'hostname' => String,
- 'id' => String,
- 'ips' => [{'address' => String}],
- 'memory' => Integer,
- 'product' => Bluebox::Compute::Formats::PRODUCT,
- 'status' => String,
- 'storage' => Integer,
- 'template' => String
+ 'cpu' => Float,
+ 'description' => String,
+ 'hostname' => String,
+ 'id' => String,
+ 'ips' => [{'address' => String}],
+ 'memory' => Integer,
+ 'product' => Bluebox::Compute::Formats::PRODUCT,
+ 'status' => String,
+ 'storage' => Integer,
+ 'template' => String,
+ 'lb_applications' => Array,
+ 'lb_options' => {'weight' => Integer, 'port' => Integer, 'backup' => String}
}
tests('success') do
- @product_id = '94fd37a7-2606-47f7-84d5-9000deda52ae' # 1 GB
- @template_id = 'a00baa8f-b5d0-4815-8238-b471c4c4bf72' # Ubuntu 9.10 64bit
- @password = 'chunkybacon'
+ @product_id = '94fd37a7-2606-47f7-84d5-9000deda52ae' # 1 GB
+ @template_id = 'a00baa8f-b5d0-4815-8238-b471c4c4bf72' # Ubuntu 9.10 64bit
+ @password = 'chunkybacon'
+ @lb_applications = []
+ @lb_options = {'weight' => 1, 'port' => 80, 'backup' => 'true'}
@block_id = nil
+ @lb_block_id = nil
tests("create_block('#{@product_id}', '#{@template_id}', 'password' => '#{@password}')").formats(@block_format) do
pending if Fog.mocking?
@@ -28,6 +33,14 @@
data
end
+ tests("create_block('#{@product_id}', '#{@template_id}', 'password' => '#{@password}', 'lb_applications' => '#{@lb_applications.inspect}'), 'lb_options' => #{@lb_options.inspect}").formats(@block_format) do
+ pending if Fog.mocking?
+ data = Bluebox[:compute].create_block(@product_id, @template_id, 'password' => @password, 'lb_applications' => @lb_applications, 'lb_options' => @lb_options).body
+ @lb_block_id = data['id']
+ data
+ end
+
+
unless Fog.mocking?
Bluebox[:compute].servers.get(@block_id).wait_for { ready? }
end
@@ -56,6 +69,11 @@
Bluebox[:compute].destroy_block(@block_id).body
end
+ tests("destroy_block('#{@lb_block_id})'").formats({'text' => String}) do
+ pending if Fog.mocking?
+ Bluebox[:compute].destroy_block(@block_id).body
+ end
+
end
tests('failure') do

0 comments on commit d01faf7

Please sign in to comment.