Merge remote-tracking branch 'upstream/master' into adding_rds2_support

This commit is contained in:
Mike Fuller 2015-01-22 07:22:50 +11:00
commit 8671f1e29f
3 changed files with 9 additions and 4 deletions

View File

@ -299,6 +299,7 @@ class Instance(BotoInstance, TaggedEC2Resource):
self.subnet_id = kwargs.get("subnet_id")
self.key_name = kwargs.get("key_name")
self.source_dest_check = "true"
self.launch_time = datetime.utcnow().isoformat()
self.private_ip_address = kwargs.get('private_ip_address')
self.block_device_mapping = BlockDeviceMapping()

View File

@ -204,7 +204,7 @@ EC2_RUN_INSTANCES = """<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc
<keyName>{{ instance.key_name }}</keyName>
<amiLaunchIndex>0</amiLaunchIndex>
<instanceType>{{ instance.instance_type }}</instanceType>
<launchTime>2007-08-07T11:51:50.000Z</launchTime>
<launchTime>{{ instance.launch_time }}</launchTime>
<placement>
<availabilityZone>us-east-1b</availabilityZone>
<groupName/>
@ -325,7 +325,7 @@ EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns='http://ec2.amazona
<amiLaunchIndex>0</amiLaunchIndex>
<productCodes/>
<instanceType>{{ instance.instance_type }}</instanceType>
<launchTime>YYYY-MM-DDTHH:MM:SS+0000</launchTime>
<launchTime>{{ instance.launch_time }}</launchTime>
<placement>
<availabilityZone>us-west-2a</availabilityZone>
<groupName/>

View File

@ -4,10 +4,12 @@ import tests.backport_assert_raises
from nose.tools import assert_raises
import base64
import datetime
import boto
from boto.ec2.instance import Reservation, InstanceAttribute
from boto.exception import EC2ResponseError
from freezegun import freeze_time
import sure # noqa
from moto import mock_ec2
@ -34,6 +36,7 @@ def test_add_servers():
############################################
@freeze_time("2014-01-01 05:00:00")
@mock_ec2
def test_instance_launch_and_terminate():
conn = boto.connect_ec2('the_key', 'the_secret')
@ -50,6 +53,7 @@ def test_instance_launch_and_terminate():
instances.should.have.length_of(1)
instances[0].id.should.equal(instance.id)
instances[0].state.should.equal('running')
instances[0].launch_time.should.equal("2014-01-01T05:00:00")
root_device_name = instances[0].root_device_name
instances[0].block_device_mapping[root_device_name].status.should.equal('attached')
@ -604,13 +608,13 @@ def test_describe_instance_status_with_non_running_instances():
@mock_ec2
def test_get_instance_by_security_group():
conn = boto.connect_ec2('the_key', 'the_secret')
conn.run_instances('ami-1234abcd')
instance = conn.get_only_instances()[0]
security_group = conn.create_security_group('test', 'test')
conn.modify_instance_attribute(instance.id, "groupSet", [security_group.id])
security_group_instances = security_group.instances()
assert len(security_group_instances) == 1