2011-06-16 19:28:54 -04:00
|
|
|
Shindo.tests('Fog::Compute[:stormondemand] | server requests', ['stormondemand']) do
|
2011-04-27 21:49:56 -04:00
|
|
|
|
2011-04-30 15:29:05 -04:00
|
|
|
@server_format = {
|
2011-04-27 21:49:56 -04:00
|
|
|
'uniq_id' => String,
|
|
|
|
'accnt' => String,
|
2011-04-30 15:29:05 -04:00
|
|
|
'backup_enabled' => String,
|
2011-04-27 21:49:56 -04:00
|
|
|
'backup_plan' => String,
|
|
|
|
'backup_size' => String,
|
|
|
|
'backup_quota' => String,
|
|
|
|
'bandwidth_quota' => Integer,
|
|
|
|
'config_description' => String,
|
|
|
|
'config_id' => String,
|
|
|
|
'domain' => String,
|
|
|
|
'ip' => String,
|
|
|
|
'ip_count' => String,
|
|
|
|
'subaccnt' => String,
|
2011-12-13 19:13:04 -05:00
|
|
|
'template' => String,
|
2011-04-27 21:49:56 -04:00
|
|
|
'template_description' => String,
|
2011-12-13 19:13:04 -05:00
|
|
|
'manage_level' => String,
|
2011-04-27 21:49:56 -04:00
|
|
|
'zone' => Hash,
|
|
|
|
'active' => Integer,
|
|
|
|
'create_date' => String
|
|
|
|
}
|
2011-04-30 15:29:05 -04:00
|
|
|
|
|
|
|
@servers_format = {
|
2011-12-13 19:13:04 -05:00
|
|
|
'items' => [@server_format]
|
2011-04-30 15:29:05 -04:00
|
|
|
}
|
|
|
|
|
2011-04-27 21:49:56 -04:00
|
|
|
tests('success') do
|
|
|
|
|
|
|
|
@uniq_id = nil
|
|
|
|
@name = "fog-test#{Time.now.to_i}.com"
|
|
|
|
|
2011-04-30 15:29:05 -04:00
|
|
|
tests("#create_server(:backup_enabled => 0, :config_id => 114, :domain => '#{@name}', :template => 'CENTOSUNMANAGED', :ip_count => 1, :password => 'B92bxfijsdK3!')").formats(@server_format) do
|
2011-04-27 21:49:56 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
data = Fog::Compute[:stormondemand].create_server(:backup_enabled => 0, :config_id => 114, :domain => @name, :template => 'CENTOSUNMANAGED', :ip_count => 1, :password => 'B92bxfijsdK3!').body
|
2011-04-27 21:49:56 -04:00
|
|
|
@uniq_id = data['uniq_id']
|
|
|
|
data
|
|
|
|
end
|
|
|
|
|
2011-04-30 15:29:05 -04:00
|
|
|
tests('#list_servers').formats(@servers_format) do
|
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:stormondemand].list_servers.body
|
2011-04-27 21:49:56 -04:00
|
|
|
end
|
|
|
|
|
2011-04-30 15:29:05 -04:00
|
|
|
unless Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:stormondemand].servers.get(@uniq_id).wait_for { ready? }
|
2011-04-27 21:49:56 -04:00
|
|
|
end
|
|
|
|
|
2011-04-30 15:29:05 -04:00
|
|
|
tests("#delete_server(:uniq_id => #{@uniq_id})").succeeds do
|
2011-04-27 21:49:56 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:stormondemand].delete_server(:uniq_id => @uniq_id)
|
2011-04-27 21:49:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
2011-06-16 19:28:54 -04:00
|
|
|
tests('#delete_server(0)').raises(Fog::Compute::StormOnDemand::Error) do
|
2011-04-27 21:49:56 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:stormondemand].delete_server(:uniq_id => 'XXXXXX')
|
2011-04-27 21:49:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|