2009-07-09 00:58:02 -04:00
|
|
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
|
|
|
|
|
|
describe 'EC2.run_instances' do
|
|
|
|
|
2009-07-17 03:36:42 -04:00
|
|
|
after(:all) do
|
2009-07-19 19:50:19 -04:00
|
|
|
ec2.terminate_instances([@instance_id])
|
2009-07-17 03:36:42 -04:00
|
|
|
end
|
|
|
|
|
2009-07-09 00:58:02 -04:00
|
|
|
it "should return proper attributes" do
|
|
|
|
actual = ec2.run_instances('ami-5ee70037', 1, 1)
|
2009-07-19 19:50:19 -04:00
|
|
|
@instance_id = actual.body[:instances_set].first[:instance_id]
|
|
|
|
actual.body[:group_set].should be_an(Array)
|
|
|
|
actual.body[:group_set].first.should be_a(String)
|
|
|
|
actual.body[:instances_set].should be_an(Array)
|
|
|
|
instance = actual.body[:instances_set].first
|
2009-07-21 13:56:38 -04:00
|
|
|
instance[:ami_launch_index].should be_a(Integer)
|
2009-07-19 19:50:19 -04:00
|
|
|
instance[:dns_name].should be_a(String)
|
|
|
|
instance[:image_id].should be_a(String)
|
|
|
|
instance[:instance_id].should be_a(String)
|
|
|
|
instance[:instance_state].should be_an(Hash)
|
|
|
|
instance[:instance_state][:code].should be_an(Integer)
|
|
|
|
instance[:instance_state][:name].should be_an(String)
|
|
|
|
instance[:instance_type].should be_a(String)
|
2009-07-21 13:56:38 -04:00
|
|
|
instance[:kernel_id].should be_a(String)
|
2009-07-19 19:50:19 -04:00
|
|
|
# instance[:key_name].should be_a(String)
|
|
|
|
instance[:launch_time].should be_a(Time)
|
|
|
|
instance[:monitoring].should be_a(Hash)
|
|
|
|
[false, true].should include(instance[:monitoring][:state])
|
|
|
|
instance[:placement].should be_a(Hash)
|
|
|
|
instance[:placement][:availability_zone].should be_a(String)
|
|
|
|
instance[:private_dns_name].should be_a(String)
|
2009-07-21 13:56:38 -04:00
|
|
|
instance[:ramdisk_id].should be_a(String)
|
2009-07-19 19:50:19 -04:00
|
|
|
instance[:reason].should be_a(String)
|
|
|
|
actual.body[:owner_id].should be_a(String)
|
|
|
|
actual.body[:request_id].should be_a(String)
|
|
|
|
actual.body[:reservation_id].should be_a(String)
|
2009-07-09 00:58:02 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|