2009-08-17 15:55:30 -07:00
|
|
|
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2009-07-08 21:58:02 -07:00
|
|
|
|
|
|
|
describe 'EC2.run_instances' do
|
2009-08-19 20:32:57 -07:00
|
|
|
describe 'success' do
|
2009-07-08 21:58:02 -07:00
|
|
|
|
2009-08-19 20:32:57 -07:00
|
|
|
after(:each) do
|
2009-09-11 20:47:32 -07:00
|
|
|
ec2.terminate_instances(@instance_id)
|
2009-08-19 20:32:57 -07:00
|
|
|
end
|
2009-07-17 00:36:42 -07:00
|
|
|
|
2009-08-19 20:32:57 -07:00
|
|
|
it "should return proper attributes" do
|
2009-10-18 18:11:19 -07:00
|
|
|
# ami-5ee70037 = gentoo
|
2009-10-22 09:42:02 -07:00
|
|
|
actual = ec2.run_instances(GENTOO_AMI, 1, 1)
|
2009-08-19 20:32:57 -07:00
|
|
|
@instance_id = actual.body['instancesSet'].first['instanceId']
|
|
|
|
actual.body['groupSet'].should be_an(Array)
|
|
|
|
actual.body['groupSet'].first.should be_a(String)
|
|
|
|
actual.body['instancesSet'].should be_an(Array)
|
|
|
|
instance = actual.body['instancesSet'].first
|
|
|
|
instance['amiLaunchIndex'].should be_a(Integer)
|
|
|
|
instance['dnsName'].should be_a(String)
|
|
|
|
instance['imageId'].should be_a(String)
|
|
|
|
instance['instanceId'].should be_a(String)
|
|
|
|
instance['instanceState'].should be_an(Hash)
|
|
|
|
instance['instanceState']['code'].should be_an(Integer)
|
|
|
|
instance['instanceState']['name'].should be_an(String)
|
|
|
|
instance['instanceType'].should be_a(String)
|
|
|
|
instance['kernelId'].should be_a(String)
|
|
|
|
instance['keyName'].should be_a(String) if instance['keyName']
|
|
|
|
instance['launchTime'].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']['availabilityZone'].should be_a(String)
|
|
|
|
instance['privateDnsName'].should be_a(String)
|
|
|
|
instance['ramdiskId'].should be_a(String)
|
|
|
|
instance['reason'].should be_a(String)
|
|
|
|
actual.body['ownerId'].should be_a(String)
|
|
|
|
actual.body['requestId'].should be_a(String)
|
|
|
|
actual.body['reservationId'].should be_a(String)
|
|
|
|
end
|
2009-07-08 21:58:02 -07:00
|
|
|
|
2009-08-19 20:32:57 -07:00
|
|
|
end
|
2009-07-08 21:58:02 -07:00
|
|
|
end
|