deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [11/13] EC2: Added initial support for EC2 driver unit tests
Date Tue, 24 Jul 2012 07:39:48 GMT
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/ec2/fixtures/test_0006_must_allow_to_create_multiple_instances_using_the_instance_count_parameter-i-66ebc41e-running-9.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/fixtures/test_0006_must_allow_to_create_multiple_instances_using_the_instance_count_parameter-i-66ebc41e-running-9.yml b/server/tests/drivers/ec2/fixtures/test_0006_must_allow_to_create_multiple_instances_using_the_instance_count_parameter-i-66ebc41e-running-9.yml
new file mode 100644
index 0000000..4e56306
--- /dev/null
+++ b/server/tests/drivers/ec2/fixtures/test_0006_must_allow_to_create_multiple_instances_using_the_instance_count_parameter-i-66ebc41e-running-9.yml
@@ -0,0 +1,51 @@
+---
+http_interactions:
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=DescribeInstances&InstanceId.1=i-66ebc41e&Signature=iUvi16C5PceLaBL5YrWL93FjyckyqHHzWjQHV2pwn/A=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:24:00 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>9ca05c72-db5d-4729-82a6-0b499b287eb9</requestId>\n
+        \   <reservationSet>\n        <item>\n            <reservationId>r-3e7bb05a</reservationId>\n
+        \           <ownerId>293787749884</ownerId>\n            <groupSet>\n                <item>\n
+        \                   <groupId>default</groupId>\n                </item>\n
+        \           </groupSet>\n            <instancesSet>\n                <item>\n
+        \                   <instanceId>i-66ebc41e</instanceId>\n                    <imageId>ami-aecd60c7</imageId>\n
+        \                   <instanceState>\n                        <code>0</code>\n
+        \                       <name>pending</name>\n                    </instanceState>\n
+        \                   <privateDnsName/>\n                    <dnsName/>\n                    <reason/>\n
+        \                   <amiLaunchIndex>0</amiLaunchIndex>\n                    <productCodes/>\n
+        \                   <instanceType>t1.micro</instanceType>\n                    <launchTime>2012-07-23T12:23:49.000Z</launchTime>\n
+        \                   <placement>\n                        <availabilityZone>us-east-1a</availabilityZone>\n
+        \                       <groupName/>\n                    </placement>\n                    <kernelId>aki-88aa75e1</kernelId>\n
+        \                   <monitoring>\n                        <state>disabled</state>\n
+        \                   </monitoring>\n                    <architecture>x86_64</architecture>\n
+        \                   <rootDeviceType>ebs</rootDeviceType>\n                    <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \                   <blockDeviceMapping/>\n                    <virtualizationType>paravirtual</virtualizationType>\n
+        \                   <clientToken/>\n                </item>\n            </instancesSet>\n
+        \       </item>\n    </reservationSet>\n</DescribeInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+recorded_with: VCR 2.1.1

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/ec2/fixtures/test_0006_must_allow_to_create_multiple_instances_using_the_instance_count_parameter-i-66ebc41e-stopped-10.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/fixtures/test_0006_must_allow_to_create_multiple_instances_using_the_instance_count_parameter-i-66ebc41e-stopped-10.yml b/server/tests/drivers/ec2/fixtures/test_0006_must_allow_to_create_multiple_instances_using_the_instance_count_parameter-i-66ebc41e-stopped-10.yml
new file mode 100644
index 0000000..948f904
--- /dev/null
+++ b/server/tests/drivers/ec2/fixtures/test_0006_must_allow_to_create_multiple_instances_using_the_instance_count_parameter-i-66ebc41e-stopped-10.yml
@@ -0,0 +1,62 @@
+---
+http_interactions:
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=DescribeInstances&InstanceId.1=i-66ebc41e&Signature=iUvi16C5PceLaBL5YrWL93FjyckyqHHzWjQHV2pwn/A=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:24:27 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>174a13f4-a933-42c5-aaed-baa521aefce2</requestId>\n
+        \   <reservationSet>\n        <item>\n            <reservationId>r-3e7bb05a</reservationId>\n
+        \           <ownerId>293787749884</ownerId>\n            <groupSet>\n                <item>\n
+        \                   <groupId>default</groupId>\n                </item>\n
+        \           </groupSet>\n            <instancesSet>\n                <item>\n
+        \                   <instanceId>i-66ebc41e</instanceId>\n                    <imageId>ami-aecd60c7</imageId>\n
+        \                   <instanceState>\n                        <code>32</code>\n
+        \                       <name>shutting-down</name>\n                    </instanceState>\n
+        \                   <privateDnsName>domU-12-31-39-09-88-3E.compute-1.internal</privateDnsName>\n
+        \                   <dnsName>ec2-23-20-249-105.compute-1.amazonaws.com</dnsName>\n
+        \                   <reason>User initiated (2012-07-23 12:24:23 GMT)</reason>\n
+        \                   <amiLaunchIndex>0</amiLaunchIndex>\n                    <productCodes/>\n
+        \                   <instanceType>t1.micro</instanceType>\n                    <launchTime>2012-07-23T12:23:49.000Z</launchTime>\n
+        \                   <placement>\n                        <availabilityZone>us-east-1a</availabilityZone>\n
+        \                       <groupName/>\n                    </placement>\n                    <kernelId>aki-88aa75e1</kernelId>\n
+        \                   <monitoring>\n                        <state>disabled</state>\n
+        \                   </monitoring>\n                    <privateIpAddress>10.210.143.204</privateIpAddress>\n
+        \                   <ipAddress>23.20.249.105</ipAddress>\n                    <stateReason>\n
+        \                       <code>Client.UserInitiatedShutdown</code>\n                        <message>Client.UserInitiatedShutdown:
+        User initiated shutdown</message>\n                    </stateReason>\n                    <architecture>x86_64</architecture>\n
+        \                   <rootDeviceType>ebs</rootDeviceType>\n                    <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \                   <blockDeviceMapping>\n                        <item>\n
+        \                           <deviceName>/dev/sda1</deviceName>\n                            <ebs>\n
+        \                               <volumeId>vol-00d08b61</volumeId>\n                                <status>attached</status>\n
+        \                               <attachTime>2012-07-23T12:24:14.000Z</attachTime>\n
+        \                               <deleteOnTermination>true</deleteOnTermination>\n
+        \                           </ebs>\n                        </item>\n                    </blockDeviceMapping>\n
+        \                   <virtualizationType>paravirtual</virtualizationType>\n
+        \                   <clientToken/>\n                </item>\n            </instancesSet>\n
+        \       </item>\n    </reservationSet>\n</DescribeInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+recorded_with: VCR 2.1.1

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/ec2/fixtures/test_0006_must_allow_to_create_multiple_instances_using_the_instance_count_parameter.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/fixtures/test_0006_must_allow_to_create_multiple_instances_using_the_instance_count_parameter.yml b/server/tests/drivers/ec2/fixtures/test_0006_must_allow_to_create_multiple_instances_using_the_instance_count_parameter.yml
new file mode 100644
index 0000000..682093b
--- /dev/null
+++ b/server/tests/drivers/ec2/fixtures/test_0006_must_allow_to_create_multiple_instances_using_the_instance_count_parameter.yml
@@ -0,0 +1,250 @@
+---
+http_interactions:
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=RunInstances&AddressingType=public&ImageId=ami-aecd60c7&InstanceType=t1.micro&MaxCount=2&MinCount=2&Placement.AvailabilityZone=us-east-1a&Signature=+LCIvYh+abOm/dhygXeKL+cc9GgS0BhtKo9mMsb9G7o=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:23:49 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<RunInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>b15c9ec7-7af8-4249-b379-bb0c05e77b37</requestId>\n
+        \   <reservationId>r-3e7bb05a</reservationId>\n    <ownerId>293787749884</ownerId>\n
+        \   <groupSet>\n        <item>\n            <groupId>default</groupId>\n        </item>\n
+        \   </groupSet>\n    <instancesSet>\n        <item>\n            <instanceId>i-66ebc41e</instanceId>\n
+        \           <imageId>ami-aecd60c7</imageId>\n            <instanceState>\n
+        \               <code>0</code>\n                <name>pending</name>\n            </instanceState>\n
+        \           <privateDnsName/>\n            <dnsName/>\n            <reason/>\n
+        \           <amiLaunchIndex>0</amiLaunchIndex>\n            <productCodes/>\n
+        \           <instanceType>t1.micro</instanceType>\n            <launchTime>2012-07-23T12:23:49.000Z</launchTime>\n
+        \           <placement>\n                <availabilityZone>us-east-1a</availabilityZone>\n
+        \               <groupName/>\n            </placement>\n            <kernelId>aki-88aa75e1</kernelId>\n
+        \           <monitoring>\n                <state>disabled</state>\n            </monitoring>\n
+        \           <stateReason>\n                <code>pending</code>\n                <message>pending</message>\n
+        \           </stateReason>\n            <architecture>x86_64</architecture>\n
+        \           <rootDeviceType>ebs</rootDeviceType>\n            <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \           <blockDeviceMapping/>\n            <virtualizationType>paravirtual</virtualizationType>\n
+        \           <clientToken/>\n        </item>\n        <item>\n            <instanceId>i-58ebc420</instanceId>\n
+        \           <imageId>ami-aecd60c7</imageId>\n            <instanceState>\n
+        \               <code>0</code>\n                <name>pending</name>\n            </instanceState>\n
+        \           <privateDnsName/>\n            <dnsName/>\n            <reason/>\n
+        \           <amiLaunchIndex>1</amiLaunchIndex>\n            <productCodes/>\n
+        \           <instanceType>t1.micro</instanceType>\n            <launchTime>2012-07-23T12:23:49.000Z</launchTime>\n
+        \           <placement>\n                <availabilityZone>us-east-1a</availabilityZone>\n
+        \               <groupName/>\n            </placement>\n            <kernelId>aki-88aa75e1</kernelId>\n
+        \           <monitoring>\n                <state>disabled</state>\n            </monitoring>\n
+        \           <stateReason>\n                <code>pending</code>\n                <message>pending</message>\n
+        \           </stateReason>\n            <architecture>x86_64</architecture>\n
+        \           <rootDeviceType>ebs</rootDeviceType>\n            <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \           <blockDeviceMapping/>\n            <virtualizationType>paravirtual</virtualizationType>\n
+        \           <clientToken/>\n        </item>\n    </instancesSet>\n</RunInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=TerminateInstances&InstanceId.1=i-66ebc41e&Signature=Tg349P82reMElSjCjGbtTqCq41oy3+HCtyoeWp3RX0U=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:24:22 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TerminateInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>2b460988-01ab-47a6-8490-28f391c45c56</requestId>\n
+        \   <instancesSet>\n        <item>\n            <instanceId>i-66ebc41e</instanceId>\n
+        \           <currentState>\n                <code>32</code>\n                <name>shutting-down</name>\n
+        \           </currentState>\n            <previousState>\n                <code>16</code>\n
+        \               <name>running</name>\n            </previousState>\n        </item>\n
+        \   </instancesSet>\n</TerminateInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=DescribeInstances&InstanceId.1=i-66ebc41e&Signature=iUvi16C5PceLaBL5YrWL93FjyckyqHHzWjQHV2pwn/A=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:24:23 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>e5a7afea-af43-4037-941b-741dc8389f7e</requestId>\n
+        \   <reservationSet>\n        <item>\n            <reservationId>r-3e7bb05a</reservationId>\n
+        \           <ownerId>293787749884</ownerId>\n            <groupSet>\n                <item>\n
+        \                   <groupId>default</groupId>\n                </item>\n
+        \           </groupSet>\n            <instancesSet>\n                <item>\n
+        \                   <instanceId>i-66ebc41e</instanceId>\n                    <imageId>ami-aecd60c7</imageId>\n
+        \                   <instanceState>\n                        <code>32</code>\n
+        \                       <name>shutting-down</name>\n                    </instanceState>\n
+        \                   <privateDnsName>domU-12-31-39-09-88-3E.compute-1.internal</privateDnsName>\n
+        \                   <dnsName>ec2-23-20-249-105.compute-1.amazonaws.com</dnsName>\n
+        \                   <reason>User initiated (2012-07-23 12:24:23 GMT)</reason>\n
+        \                   <amiLaunchIndex>0</amiLaunchIndex>\n                    <productCodes/>\n
+        \                   <instanceType>t1.micro</instanceType>\n                    <launchTime>2012-07-23T12:23:49.000Z</launchTime>\n
+        \                   <placement>\n                        <availabilityZone>us-east-1a</availabilityZone>\n
+        \                       <groupName/>\n                    </placement>\n                    <kernelId>aki-88aa75e1</kernelId>\n
+        \                   <monitoring>\n                        <state>disabled</state>\n
+        \                   </monitoring>\n                    <privateIpAddress>10.210.143.204</privateIpAddress>\n
+        \                   <ipAddress>23.20.249.105</ipAddress>\n                    <stateReason>\n
+        \                       <code>Client.UserInitiatedShutdown</code>\n                        <message>Client.UserInitiatedShutdown:
+        User initiated shutdown</message>\n                    </stateReason>\n                    <architecture>x86_64</architecture>\n
+        \                   <rootDeviceType>ebs</rootDeviceType>\n                    <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \                   <blockDeviceMapping>\n                        <item>\n
+        \                           <deviceName>/dev/sda1</deviceName>\n                            <ebs>\n
+        \                               <volumeId>vol-00d08b61</volumeId>\n                                <status>attached</status>\n
+        \                               <attachTime>2012-07-23T12:24:14.000Z</attachTime>\n
+        \                               <deleteOnTermination>true</deleteOnTermination>\n
+        \                           </ebs>\n                        </item>\n                    </blockDeviceMapping>\n
+        \                   <virtualizationType>paravirtual</virtualizationType>\n
+        \                   <clientToken/>\n                </item>\n            </instancesSet>\n
+        \       </item>\n    </reservationSet>\n</DescribeInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=TerminateInstances&InstanceId.1=i-58ebc420&Signature=qqiyekh1qKKweIq7czpbTjdUOdozm6APuWjjdF9g+Hg=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:24:24 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TerminateInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>5cd340ca-f49c-47d3-a7fa-4b813844ed3a</requestId>\n
+        \   <instancesSet>\n        <item>\n            <instanceId>i-58ebc420</instanceId>\n
+        \           <currentState>\n                <code>32</code>\n                <name>shutting-down</name>\n
+        \           </currentState>\n            <previousState>\n                <code>16</code>\n
+        \               <name>running</name>\n            </previousState>\n        </item>\n
+        \   </instancesSet>\n</TerminateInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=DescribeInstances&InstanceId.1=i-58ebc420&Signature=+3HbDxN8wA+3KTcaAUTlt6isyhjbiDyDqEBnVVn52kg=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:24:25 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>b505627d-2683-4a03-9f4b-18438be24583</requestId>\n
+        \   <reservationSet>\n        <item>\n            <reservationId>r-3e7bb05a</reservationId>\n
+        \           <ownerId>293787749884</ownerId>\n            <groupSet>\n                <item>\n
+        \                   <groupId>default</groupId>\n                </item>\n
+        \           </groupSet>\n            <instancesSet>\n                <item>\n
+        \                   <instanceId>i-58ebc420</instanceId>\n                    <imageId>ami-aecd60c7</imageId>\n
+        \                   <instanceState>\n                        <code>32</code>\n
+        \                       <name>shutting-down</name>\n                    </instanceState>\n
+        \                   <privateDnsName>domU-12-31-39-0A-22-F4.compute-1.internal</privateDnsName>\n
+        \                   <dnsName>ec2-23-22-148-245.compute-1.amazonaws.com</dnsName>\n
+        \                   <reason>User initiated (2012-07-23 12:24:24 GMT)</reason>\n
+        \                   <amiLaunchIndex>1</amiLaunchIndex>\n                    <productCodes/>\n
+        \                   <instanceType>t1.micro</instanceType>\n                    <launchTime>2012-07-23T12:23:49.000Z</launchTime>\n
+        \                   <placement>\n                        <availabilityZone>us-east-1a</availabilityZone>\n
+        \                       <groupName/>\n                    </placement>\n                    <kernelId>aki-88aa75e1</kernelId>\n
+        \                   <monitoring>\n                        <state>disabled</state>\n
+        \                   </monitoring>\n                    <privateIpAddress>10.211.33.6</privateIpAddress>\n
+        \                   <ipAddress>23.22.148.245</ipAddress>\n                    <stateReason>\n
+        \                       <code>Client.UserInitiatedShutdown</code>\n                        <message>Client.UserInitiatedShutdown:
+        User initiated shutdown</message>\n                    </stateReason>\n                    <architecture>x86_64</architecture>\n
+        \                   <rootDeviceType>ebs</rootDeviceType>\n                    <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \                   <blockDeviceMapping>\n                        <item>\n
+        \                           <deviceName>/dev/sda1</deviceName>\n                            <ebs>\n
+        \                               <volumeId>vol-3ed08b5f</volumeId>\n                                <status>attached</status>\n
+        \                               <attachTime>2012-07-23T12:24:13.000Z</attachTime>\n
+        \                               <deleteOnTermination>true</deleteOnTermination>\n
+        \                           </ebs>\n                        </item>\n                    </blockDeviceMapping>\n
+        \                   <virtualizationType>paravirtual</virtualizationType>\n
+        \                   <clientToken/>\n                </item>\n            </instancesSet>\n
+        \       </item>\n    </reservationSet>\n</DescribeInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+recorded_with: VCR 2.1.1

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-10.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-10.yml b/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-10.yml
new file mode 100644
index 0000000..426c613
--- /dev/null
+++ b/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-10.yml
@@ -0,0 +1,51 @@
+---
+http_interactions:
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=DescribeInstances&InstanceId.1=i-d8eac5a0&Signature=aY73r5YiXQgu3drzlk3iAYsf0ZqguttvPU4z3OILa5U=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:25:10 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>809c3d99-d8f5-4507-b14b-d75a8dd26f7a</requestId>\n
+        \   <reservationSet>\n        <item>\n            <reservationId>r-ec7ab188</reservationId>\n
+        \           <ownerId>293787749884</ownerId>\n            <groupSet>\n                <item>\n
+        \                   <groupId>default</groupId>\n                </item>\n
+        \           </groupSet>\n            <instancesSet>\n                <item>\n
+        \                   <instanceId>i-d8eac5a0</instanceId>\n                    <imageId>ami-aecd60c7</imageId>\n
+        \                   <instanceState>\n                        <code>0</code>\n
+        \                       <name>pending</name>\n                    </instanceState>\n
+        \                   <privateDnsName/>\n                    <dnsName/>\n                    <reason/>\n
+        \                   <amiLaunchIndex>0</amiLaunchIndex>\n                    <productCodes/>\n
+        \                   <instanceType>t1.micro</instanceType>\n                    <launchTime>2012-07-23T12:25:10.000Z</launchTime>\n
+        \                   <placement>\n                        <availabilityZone>us-east-1a</availabilityZone>\n
+        \                       <groupName/>\n                    </placement>\n                    <kernelId>aki-88aa75e1</kernelId>\n
+        \                   <monitoring>\n                        <state>disabled</state>\n
+        \                   </monitoring>\n                    <architecture>x86_64</architecture>\n
+        \                   <rootDeviceType>ebs</rootDeviceType>\n                    <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \                   <blockDeviceMapping/>\n                    <virtualizationType>paravirtual</virtualizationType>\n
+        \                   <clientToken/>\n                </item>\n            </instancesSet>\n
+        \       </item>\n    </reservationSet>\n</DescribeInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+recorded_with: VCR 2.1.1

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-7.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-7.yml b/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-7.yml
new file mode 100644
index 0000000..c73b968
--- /dev/null
+++ b/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-7.yml
@@ -0,0 +1,60 @@
+---
+http_interactions:
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=DescribeInstances&InstanceId.1=i-d8eac5a0&Signature=aY73r5YiXQgu3drzlk3iAYsf0ZqguttvPU4z3OILa5U=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:25:44 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>d1b6c987-6002-4b60-a5fc-dda212f54259</requestId>\n
+        \   <reservationSet>\n        <item>\n            <reservationId>r-ec7ab188</reservationId>\n
+        \           <ownerId>293787749884</ownerId>\n            <groupSet>\n                <item>\n
+        \                   <groupId>default</groupId>\n                </item>\n
+        \           </groupSet>\n            <instancesSet>\n                <item>\n
+        \                   <instanceId>i-d8eac5a0</instanceId>\n                    <imageId>ami-aecd60c7</imageId>\n
+        \                   <instanceState>\n                        <code>16</code>\n
+        \                       <name>running</name>\n                    </instanceState>\n
+        \                   <privateDnsName>domU-12-31-39-0A-08-B4.compute-1.internal</privateDnsName>\n
+        \                   <dnsName>ec2-184-73-42-198.compute-1.amazonaws.com</dnsName>\n
+        \                   <reason/>\n                    <amiLaunchIndex>0</amiLaunchIndex>\n
+        \                   <productCodes/>\n                    <instanceType>t1.micro</instanceType>\n
+        \                   <launchTime>2012-07-23T12:25:10.000Z</launchTime>\n                    <placement>\n
+        \                       <availabilityZone>us-east-1a</availabilityZone>\n
+        \                       <groupName/>\n                    </placement>\n                    <kernelId>aki-88aa75e1</kernelId>\n
+        \                   <monitoring>\n                        <state>disabled</state>\n
+        \                   </monitoring>\n                    <privateIpAddress>10.211.11.66</privateIpAddress>\n
+        \                   <ipAddress>184.73.42.198</ipAddress>\n                    <architecture>x86_64</architecture>\n
+        \                   <rootDeviceType>ebs</rootDeviceType>\n                    <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \                   <blockDeviceMapping>\n                        <item>\n
+        \                           <deviceName>/dev/sda1</deviceName>\n                            <ebs>\n
+        \                               <volumeId>vol-d4d78cb5</volumeId>\n                                <status>attached</status>\n
+        \                               <attachTime>2012-07-23T12:25:36.000Z</attachTime>\n
+        \                               <deleteOnTermination>true</deleteOnTermination>\n
+        \                           </ebs>\n                        </item>\n                    </blockDeviceMapping>\n
+        \                   <virtualizationType>paravirtual</virtualizationType>\n
+        \                   <clientToken/>\n                </item>\n            </instancesSet>\n
+        \       </item>\n    </reservationSet>\n</DescribeInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+recorded_with: VCR 2.1.1

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-8.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-8.yml b/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-8.yml
new file mode 100644
index 0000000..c56699b
--- /dev/null
+++ b/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-8.yml
@@ -0,0 +1,60 @@
+---
+http_interactions:
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=DescribeInstances&InstanceId.1=i-d8eac5a0&Signature=aY73r5YiXQgu3drzlk3iAYsf0ZqguttvPU4z3OILa5U=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:25:32 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>09773049-a276-4bbf-97ae-3de792b75a2d</requestId>\n
+        \   <reservationSet>\n        <item>\n            <reservationId>r-ec7ab188</reservationId>\n
+        \           <ownerId>293787749884</ownerId>\n            <groupSet>\n                <item>\n
+        \                   <groupId>default</groupId>\n                </item>\n
+        \           </groupSet>\n            <instancesSet>\n                <item>\n
+        \                   <instanceId>i-d8eac5a0</instanceId>\n                    <imageId>ami-aecd60c7</imageId>\n
+        \                   <instanceState>\n                        <code>0</code>\n
+        \                       <name>pending</name>\n                    </instanceState>\n
+        \                   <privateDnsName>domU-12-31-39-0A-08-B4.compute-1.internal</privateDnsName>\n
+        \                   <dnsName>ec2-184-73-42-198.compute-1.amazonaws.com</dnsName>\n
+        \                   <reason/>\n                    <amiLaunchIndex>0</amiLaunchIndex>\n
+        \                   <productCodes/>\n                    <instanceType>t1.micro</instanceType>\n
+        \                   <launchTime>2012-07-23T12:25:10.000Z</launchTime>\n                    <placement>\n
+        \                       <availabilityZone>us-east-1a</availabilityZone>\n
+        \                       <groupName/>\n                    </placement>\n                    <kernelId>aki-88aa75e1</kernelId>\n
+        \                   <monitoring>\n                        <state>disabled</state>\n
+        \                   </monitoring>\n                    <privateIpAddress>10.211.11.66</privateIpAddress>\n
+        \                   <ipAddress>184.73.42.198</ipAddress>\n                    <architecture>x86_64</architecture>\n
+        \                   <rootDeviceType>ebs</rootDeviceType>\n                    <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \                   <blockDeviceMapping>\n                        <item>\n
+        \                           <deviceName>/dev/sda1</deviceName>\n                            <ebs>\n
+        \                               <volumeId>vol-d4d78cb5</volumeId>\n                                <status>attaching</status>\n
+        \                               <attachTime>2012-07-23T12:25:16.000Z</attachTime>\n
+        \                               <deleteOnTermination>true</deleteOnTermination>\n
+        \                           </ebs>\n                        </item>\n                    </blockDeviceMapping>\n
+        \                   <virtualizationType>paravirtual</virtualizationType>\n
+        \                   <clientToken/>\n                </item>\n            </instancesSet>\n
+        \       </item>\n    </reservationSet>\n</DescribeInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+recorded_with: VCR 2.1.1

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-9.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-9.yml b/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-9.yml
new file mode 100644
index 0000000..804f5e4
--- /dev/null
+++ b/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-9.yml
@@ -0,0 +1,60 @@
+---
+http_interactions:
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=DescribeInstances&InstanceId.1=i-d8eac5a0&Signature=aY73r5YiXQgu3drzlk3iAYsf0ZqguttvPU4z3OILa5U=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:25:21 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>ec47731f-780e-4be3-91ee-ff4ac74bf761</requestId>\n
+        \   <reservationSet>\n        <item>\n            <reservationId>r-ec7ab188</reservationId>\n
+        \           <ownerId>293787749884</ownerId>\n            <groupSet>\n                <item>\n
+        \                   <groupId>default</groupId>\n                </item>\n
+        \           </groupSet>\n            <instancesSet>\n                <item>\n
+        \                   <instanceId>i-d8eac5a0</instanceId>\n                    <imageId>ami-aecd60c7</imageId>\n
+        \                   <instanceState>\n                        <code>0</code>\n
+        \                       <name>pending</name>\n                    </instanceState>\n
+        \                   <privateDnsName>domU-12-31-39-0A-08-B4.compute-1.internal</privateDnsName>\n
+        \                   <dnsName>ec2-184-73-42-198.compute-1.amazonaws.com</dnsName>\n
+        \                   <reason/>\n                    <amiLaunchIndex>0</amiLaunchIndex>\n
+        \                   <productCodes/>\n                    <instanceType>t1.micro</instanceType>\n
+        \                   <launchTime>2012-07-23T12:25:10.000Z</launchTime>\n                    <placement>\n
+        \                       <availabilityZone>us-east-1a</availabilityZone>\n
+        \                       <groupName/>\n                    </placement>\n                    <kernelId>aki-88aa75e1</kernelId>\n
+        \                   <monitoring>\n                        <state>disabled</state>\n
+        \                   </monitoring>\n                    <privateIpAddress>10.211.11.66</privateIpAddress>\n
+        \                   <ipAddress>184.73.42.198</ipAddress>\n                    <architecture>x86_64</architecture>\n
+        \                   <rootDeviceType>ebs</rootDeviceType>\n                    <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \                   <blockDeviceMapping>\n                        <item>\n
+        \                           <deviceName>/dev/sda1</deviceName>\n                            <ebs>\n
+        \                               <volumeId>vol-d4d78cb5</volumeId>\n                                <status>attaching</status>\n
+        \                               <attachTime>2012-07-23T12:25:16.000Z</attachTime>\n
+        \                               <deleteOnTermination>true</deleteOnTermination>\n
+        \                           </ebs>\n                        </item>\n                    </blockDeviceMapping>\n
+        \                   <virtualizationType>paravirtual</virtualizationType>\n
+        \                   <clientToken/>\n                </item>\n            </instancesSet>\n
+        \       </item>\n    </reservationSet>\n</DescribeInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+recorded_with: VCR 2.1.1

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-stopped-10.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-stopped-10.yml b/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-stopped-10.yml
new file mode 100644
index 0000000..4cde33e
--- /dev/null
+++ b/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state-stopped-10.yml
@@ -0,0 +1,62 @@
+---
+http_interactions:
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=DescribeInstances&InstanceId.1=i-d8eac5a0&Signature=aY73r5YiXQgu3drzlk3iAYsf0ZqguttvPU4z3OILa5U=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:25:47 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>d55eb974-77cb-4282-9548-cd42b2f149af</requestId>\n
+        \   <reservationSet>\n        <item>\n            <reservationId>r-ec7ab188</reservationId>\n
+        \           <ownerId>293787749884</ownerId>\n            <groupSet>\n                <item>\n
+        \                   <groupId>default</groupId>\n                </item>\n
+        \           </groupSet>\n            <instancesSet>\n                <item>\n
+        \                   <instanceId>i-d8eac5a0</instanceId>\n                    <imageId>ami-aecd60c7</imageId>\n
+        \                   <instanceState>\n                        <code>32</code>\n
+        \                       <name>shutting-down</name>\n                    </instanceState>\n
+        \                   <privateDnsName>domU-12-31-39-0A-08-B4.compute-1.internal</privateDnsName>\n
+        \                   <dnsName>ec2-184-73-42-198.compute-1.amazonaws.com</dnsName>\n
+        \                   <reason>User initiated (2012-07-23 12:25:46 GMT)</reason>\n
+        \                   <amiLaunchIndex>0</amiLaunchIndex>\n                    <productCodes/>\n
+        \                   <instanceType>t1.micro</instanceType>\n                    <launchTime>2012-07-23T12:25:10.000Z</launchTime>\n
+        \                   <placement>\n                        <availabilityZone>us-east-1a</availabilityZone>\n
+        \                       <groupName/>\n                    </placement>\n                    <kernelId>aki-88aa75e1</kernelId>\n
+        \                   <monitoring>\n                        <state>disabled</state>\n
+        \                   </monitoring>\n                    <privateIpAddress>10.211.11.66</privateIpAddress>\n
+        \                   <ipAddress>184.73.42.198</ipAddress>\n                    <stateReason>\n
+        \                       <code>Client.UserInitiatedShutdown</code>\n                        <message>Client.UserInitiatedShutdown:
+        User initiated shutdown</message>\n                    </stateReason>\n                    <architecture>x86_64</architecture>\n
+        \                   <rootDeviceType>ebs</rootDeviceType>\n                    <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \                   <blockDeviceMapping>\n                        <item>\n
+        \                           <deviceName>/dev/sda1</deviceName>\n                            <ebs>\n
+        \                               <volumeId>vol-d4d78cb5</volumeId>\n                                <status>attached</status>\n
+        \                               <attachTime>2012-07-23T12:25:36.000Z</attachTime>\n
+        \                               <deleteOnTermination>true</deleteOnTermination>\n
+        \                           </ebs>\n                        </item>\n                    </blockDeviceMapping>\n
+        \                   <virtualizationType>paravirtual</virtualizationType>\n
+        \                   <clientToken/>\n                </item>\n            </instancesSet>\n
+        \       </item>\n    </reservationSet>\n</DescribeInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+recorded_with: VCR 2.1.1

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state.yml b/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state.yml
new file mode 100644
index 0000000..2f1ca1a
--- /dev/null
+++ b/server/tests/drivers/ec2/fixtures/test_0007_must_allow_to_reboot_instance_in_running_state.yml
@@ -0,0 +1,288 @@
+---
+http_interactions:
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=RunInstances&AddressingType=public&ImageId=ami-aecd60c7&InstanceType=t1.micro&MaxCount=1&MinCount=1&Placement.AvailabilityZone=us-east-1a&Signature=lpmgyUxNW6IINxn58IV711CoWMnWd1zp2VJ0JsAHRtE=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:25:10 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<RunInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>382cbe21-51fb-4f36-b526-b02238c36a25</requestId>\n
+        \   <reservationId>r-ec7ab188</reservationId>\n    <ownerId>293787749884</ownerId>\n
+        \   <groupSet>\n        <item>\n            <groupId>default</groupId>\n        </item>\n
+        \   </groupSet>\n    <instancesSet>\n        <item>\n            <instanceId>i-d8eac5a0</instanceId>\n
+        \           <imageId>ami-aecd60c7</imageId>\n            <instanceState>\n
+        \               <code>0</code>\n                <name>pending</name>\n            </instanceState>\n
+        \           <privateDnsName/>\n            <dnsName/>\n            <reason/>\n
+        \           <amiLaunchIndex>0</amiLaunchIndex>\n            <productCodes/>\n
+        \           <instanceType>t1.micro</instanceType>\n            <launchTime>2012-07-23T12:25:10.000Z</launchTime>\n
+        \           <placement>\n                <availabilityZone>us-east-1a</availabilityZone>\n
+        \               <groupName/>\n            </placement>\n            <kernelId>aki-88aa75e1</kernelId>\n
+        \           <monitoring>\n                <state>disabled</state>\n            </monitoring>\n
+        \           <stateReason>\n                <code>pending</code>\n                <message>pending</message>\n
+        \           </stateReason>\n            <architecture>x86_64</architecture>\n
+        \           <rootDeviceType>ebs</rootDeviceType>\n            <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \           <blockDeviceMapping/>\n            <virtualizationType>paravirtual</virtualizationType>\n
+        \           <clientToken/>\n        </item>\n    </instancesSet>\n</RunInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=RebootInstances&InstanceId.1=i-d8eac5a0&Signature=DYsKUJ/doU6/TAN73oU5PrfEh1cCNlG+qufY/DCiVzw=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:25:44 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<RebootInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>2e7a2847-4d3d-463f-a674-28131afb1569</requestId>\n
+        \   <return>true</return>\n</RebootInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=DescribeInstances&InstanceId.1=i-d8eac5a0&Signature=aY73r5YiXQgu3drzlk3iAYsf0ZqguttvPU4z3OILa5U=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:25:45 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>f9d0f619-6337-45e8-b4e0-815971f9cb8d</requestId>\n
+        \   <reservationSet>\n        <item>\n            <reservationId>r-ec7ab188</reservationId>\n
+        \           <ownerId>293787749884</ownerId>\n            <groupSet>\n                <item>\n
+        \                   <groupId>default</groupId>\n                </item>\n
+        \           </groupSet>\n            <instancesSet>\n                <item>\n
+        \                   <instanceId>i-d8eac5a0</instanceId>\n                    <imageId>ami-aecd60c7</imageId>\n
+        \                   <instanceState>\n                        <code>16</code>\n
+        \                       <name>running</name>\n                    </instanceState>\n
+        \                   <privateDnsName>domU-12-31-39-0A-08-B4.compute-1.internal</privateDnsName>\n
+        \                   <dnsName>ec2-184-73-42-198.compute-1.amazonaws.com</dnsName>\n
+        \                   <reason/>\n                    <amiLaunchIndex>0</amiLaunchIndex>\n
+        \                   <productCodes/>\n                    <instanceType>t1.micro</instanceType>\n
+        \                   <launchTime>2012-07-23T12:25:10.000Z</launchTime>\n                    <placement>\n
+        \                       <availabilityZone>us-east-1a</availabilityZone>\n
+        \                       <groupName/>\n                    </placement>\n                    <kernelId>aki-88aa75e1</kernelId>\n
+        \                   <monitoring>\n                        <state>disabled</state>\n
+        \                   </monitoring>\n                    <privateIpAddress>10.211.11.66</privateIpAddress>\n
+        \                   <ipAddress>184.73.42.198</ipAddress>\n                    <architecture>x86_64</architecture>\n
+        \                   <rootDeviceType>ebs</rootDeviceType>\n                    <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \                   <blockDeviceMapping>\n                        <item>\n
+        \                           <deviceName>/dev/sda1</deviceName>\n                            <ebs>\n
+        \                               <volumeId>vol-d4d78cb5</volumeId>\n                                <status>attached</status>\n
+        \                               <attachTime>2012-07-23T12:25:36.000Z</attachTime>\n
+        \                               <deleteOnTermination>true</deleteOnTermination>\n
+        \                           </ebs>\n                        </item>\n                    </blockDeviceMapping>\n
+        \                   <virtualizationType>paravirtual</virtualizationType>\n
+        \                   <clientToken/>\n                </item>\n            </instancesSet>\n
+        \       </item>\n    </reservationSet>\n</DescribeInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=DescribeInstances&InstanceId.1=i-d8eac5a0&Signature=aY73r5YiXQgu3drzlk3iAYsf0ZqguttvPU4z3OILa5U=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:25:45 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>6f53b05c-bc7a-4e9b-9545-afca30007039</requestId>\n
+        \   <reservationSet>\n        <item>\n            <reservationId>r-ec7ab188</reservationId>\n
+        \           <ownerId>293787749884</ownerId>\n            <groupSet>\n                <item>\n
+        \                   <groupId>default</groupId>\n                </item>\n
+        \           </groupSet>\n            <instancesSet>\n                <item>\n
+        \                   <instanceId>i-d8eac5a0</instanceId>\n                    <imageId>ami-aecd60c7</imageId>\n
+        \                   <instanceState>\n                        <code>16</code>\n
+        \                       <name>running</name>\n                    </instanceState>\n
+        \                   <privateDnsName>domU-12-31-39-0A-08-B4.compute-1.internal</privateDnsName>\n
+        \                   <dnsName>ec2-184-73-42-198.compute-1.amazonaws.com</dnsName>\n
+        \                   <reason/>\n                    <amiLaunchIndex>0</amiLaunchIndex>\n
+        \                   <productCodes/>\n                    <instanceType>t1.micro</instanceType>\n
+        \                   <launchTime>2012-07-23T12:25:10.000Z</launchTime>\n                    <placement>\n
+        \                       <availabilityZone>us-east-1a</availabilityZone>\n
+        \                       <groupName/>\n                    </placement>\n                    <kernelId>aki-88aa75e1</kernelId>\n
+        \                   <monitoring>\n                        <state>disabled</state>\n
+        \                   </monitoring>\n                    <privateIpAddress>10.211.11.66</privateIpAddress>\n
+        \                   <ipAddress>184.73.42.198</ipAddress>\n                    <architecture>x86_64</architecture>\n
+        \                   <rootDeviceType>ebs</rootDeviceType>\n                    <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \                   <blockDeviceMapping>\n                        <item>\n
+        \                           <deviceName>/dev/sda1</deviceName>\n                            <ebs>\n
+        \                               <volumeId>vol-d4d78cb5</volumeId>\n                                <status>attached</status>\n
+        \                               <attachTime>2012-07-23T12:25:36.000Z</attachTime>\n
+        \                               <deleteOnTermination>true</deleteOnTermination>\n
+        \                           </ebs>\n                        </item>\n                    </blockDeviceMapping>\n
+        \                   <virtualizationType>paravirtual</virtualizationType>\n
+        \                   <clientToken/>\n                </item>\n            </instancesSet>\n
+        \       </item>\n    </reservationSet>\n</DescribeInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=TerminateInstances&InstanceId.1=i-d8eac5a0&Signature=xAWpXfN2Tdn5BYaMRDnpWv+n3QJCTV6RKNL/Ig/Ovrk=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:25:45 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TerminateInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>6e17fa05-73a8-49a0-a32b-15a9a492e350</requestId>\n
+        \   <instancesSet>\n        <item>\n            <instanceId>i-d8eac5a0</instanceId>\n
+        \           <currentState>\n                <code>32</code>\n                <name>shutting-down</name>\n
+        \           </currentState>\n            <previousState>\n                <code>16</code>\n
+        \               <name>running</name>\n            </previousState>\n        </item>\n
+        \   </instancesSet>\n</TerminateInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+- request:
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=DescribeInstances&InstanceId.1=i-d8eac5a0&Signature=aY73r5YiXQgu3drzlk3iAYsf0ZqguttvPU4z3OILa5U=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-23T12:21:00.000Z&Version=2010-08-31
+    body:
+      encoding: US-ASCII
+      string: ''
+    headers:
+      Accept:
+      - ! '*/*'
+      User-Agent:
+      - ''
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Type:
+      - text/xml;charset=UTF-8
+      Transfer-Encoding:
+      - chunked
+      Date:
+      - Mon, 23 Jul 2012 12:25:47 GMT
+      Server:
+      - AmazonEC2
+    body:
+      encoding: US-ASCII
+      string: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<DescribeInstancesResponse
+        xmlns=\"http://ec2.amazonaws.com/doc/2010-08-31/\">\n    <requestId>af263c5b-7a92-4b4b-9286-188267f2a0e3</requestId>\n
+        \   <reservationSet>\n        <item>\n            <reservationId>r-ec7ab188</reservationId>\n
+        \           <ownerId>293787749884</ownerId>\n            <groupSet>\n                <item>\n
+        \                   <groupId>default</groupId>\n                </item>\n
+        \           </groupSet>\n            <instancesSet>\n                <item>\n
+        \                   <instanceId>i-d8eac5a0</instanceId>\n                    <imageId>ami-aecd60c7</imageId>\n
+        \                   <instanceState>\n                        <code>32</code>\n
+        \                       <name>shutting-down</name>\n                    </instanceState>\n
+        \                   <privateDnsName>domU-12-31-39-0A-08-B4.compute-1.internal</privateDnsName>\n
+        \                   <dnsName>ec2-184-73-42-198.compute-1.amazonaws.com</dnsName>\n
+        \                   <reason>User initiated (2012-07-23 12:25:46 GMT)</reason>\n
+        \                   <amiLaunchIndex>0</amiLaunchIndex>\n                    <productCodes/>\n
+        \                   <instanceType>t1.micro</instanceType>\n                    <launchTime>2012-07-23T12:25:10.000Z</launchTime>\n
+        \                   <placement>\n                        <availabilityZone>us-east-1a</availabilityZone>\n
+        \                       <groupName/>\n                    </placement>\n                    <kernelId>aki-88aa75e1</kernelId>\n
+        \                   <monitoring>\n                        <state>disabled</state>\n
+        \                   </monitoring>\n                    <privateIpAddress>10.211.11.66</privateIpAddress>\n
+        \                   <ipAddress>184.73.42.198</ipAddress>\n                    <stateReason>\n
+        \                       <code>Client.UserInitiatedShutdown</code>\n                        <message>Client.UserInitiatedShutdown:
+        User initiated shutdown</message>\n                    </stateReason>\n                    <architecture>x86_64</architecture>\n
+        \                   <rootDeviceType>ebs</rootDeviceType>\n                    <rootDeviceName>/dev/sda1</rootDeviceName>\n
+        \                   <blockDeviceMapping>\n                        <item>\n
+        \                           <deviceName>/dev/sda1</deviceName>\n                            <ebs>\n
+        \                               <volumeId>vol-d4d78cb5</volumeId>\n                                <status>attached</status>\n
+        \                               <attachTime>2012-07-23T12:25:36.000Z</attachTime>\n
+        \                               <deleteOnTermination>true</deleteOnTermination>\n
+        \                           </ebs>\n                        </item>\n                    </blockDeviceMapping>\n
+        \                   <virtualizationType>paravirtual</virtualizationType>\n
+        \                   <clientToken/>\n                </item>\n            </instancesSet>\n
+        \       </item>\n    </reservationSet>\n</DescribeInstancesResponse>"
+    http_version: 
+  recorded_at: Mon, 23 Jul 2012 12:21:00 GMT
+recorded_with: VCR 2.1.1

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/ec2/images_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/images_test.rb b/server/tests/drivers/ec2/images_test.rb
new file mode 100644
index 0000000..67220d2
--- /dev/null
+++ b/server/tests/drivers/ec2/images_test.rb
@@ -0,0 +1,49 @@
+require 'minitest/autorun'
+
+require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
+require_relative 'common.rb'
+
+describe 'Ec2Driver Images' do
+
+  before do
+    @driver = Deltacloud::new(:ec2, :user => 'AKIAIZ63KHGXIWDMBY6Q', :password => 'zUfBCbML2S6pXKS44eEEXw0Cf/G8z9hMSxP2hcLV')
+    VCR.insert_cassette __name__
+  end
+
+  after do
+    VCR.eject_cassette
+  end
+
+  it 'must throw error when wrong credentials' do
+    Proc.new do
+      @driver.backend.images(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
+    end.must_raise Deltacloud::ExceptionHandler::AuthenticationFailure, 'Authentication Failure'
+  end
+
+  it 'must return list of images' do
+    @driver.images.wont_be_empty
+    @driver.images.first.must_be_kind_of Image
+  end
+
+  it 'must allow to filter images' do
+    @driver.images(:id => 'ami-aecd60c7').wont_be_empty
+    @driver.images(:id => 'ami-aecd60c7').must_be_kind_of Array
+    @driver.images(:id => 'ami-aecd60c7').size.must_equal 1
+    @driver.images(:id => 'ami-aecd60c7').first.id.must_equal 'ami-aecd60c7'
+    @driver.images(:owner_id => '137112412989').each do |img|
+      img.owner_id.must_equal '137112412989'
+    end
+    @driver.images(:id => 'ami-aaaaaaaa').must_be_empty
+    @driver.images(:id => 'unknown').must_be_empty
+  end
+
+  it 'must allow to retrieve single image' do
+    @driver.image(:id => 'ami-aecd60c7').wont_be_nil
+    @driver.image(:id => 'ami-aecd60c7').must_be_kind_of Image
+    @driver.image(:id => 'ami-aecd60c7').id.must_equal 'ami-aecd60c7'
+    @driver.image(:id => 'ami-aaaaaaaa').must_be_nil
+    @driver.image(:id => 'unknown').must_be_nil
+  end
+
+end
+

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/ec2/instance_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/instance_test.rb b/server/tests/drivers/ec2/instance_test.rb
new file mode 100644
index 0000000..38ecf3e
--- /dev/null
+++ b/server/tests/drivers/ec2/instance_test.rb
@@ -0,0 +1,104 @@
+require 'minitest/autorun'
+
+require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
+require_relative 'common.rb'
+
+describe 'Ec2Driver Instances' do
+
+  before do
+    @driver = Deltacloud::new(:ec2, :user => 'AKIAIZ63KHGXIWDMBY6Q', :password => 'zUfBCbML2S6pXKS44eEEXw0Cf/G8z9hMSxP2hcLV')
+    VCR.insert_cassette __name__
+  end
+
+  after do
+    VCR.eject_cassette
+  end
+
+  it 'must throw error when wrong credentials' do
+    Proc.new do
+      @driver.backend.images(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
+    end.must_raise Deltacloud::ExceptionHandler::AuthenticationFailure, 'Authentication Failure'
+  end
+
+  it 'must return list of instances' do
+    @driver.instances.wont_be_empty
+    @driver.instances.first.must_be_kind_of Instance
+  end
+
+  it 'must allow to filter instances' do
+    @driver.instances(:id => 'i-4cdcf034').wont_be_empty
+    @driver.instances(:id => 'i-4cdcf034').must_be_kind_of Array
+    @driver.instances(:id => 'i-4cdcf034').size.must_equal 1
+    @driver.instances(:id => 'i-4cdcf034').first.id.must_equal 'i-4cdcf034'
+    @driver.instances(:owner_id => '293787749884').wont_be_empty
+    @driver.instances(:owner_id => '293787749884').each do |inst|
+      inst.owner_id.must_equal '293787749884'
+    end
+    @driver.instances(:id => 'i-00000000').must_be_empty
+    @driver.instances(:id => 'unknown').must_be_empty
+  end
+
+  it 'must allow to retrieve single instance' do
+    @driver.instance(:id => 'i-4cdcf034').wont_be_nil
+    @driver.instance(:id => 'i-4cdcf034').must_be_kind_of Instance
+    @driver.instance(:id => 'i-4cdcf034').id.must_equal 'i-4cdcf034'
+    @driver.instance(:id => 'i-00000000').must_be_nil
+    @driver.instance(:id => 'unknown').must_be_nil
+  end
+
+  it 'must allow to create a new instance if instance supported' do
+    instance = @driver.create_instance('ami-aecd60c7',
+                                       :realm_id => 'us-east-1a',
+                                       :hwp_id => 't1.micro',
+                                       :keyname => 'test1',
+                                       :user_data => 'test user data',
+                                       :'firewalls1' => 'default'
+                                      )
+    instance = instance.wait_for!(@driver, record_retries) { |i| i.is_running? }
+    instance.must_be_kind_of Instance
+    instance.is_running?.must_equal true
+    @driver.instance(:id => instance.id).wont_be_nil
+    @driver.instance(:id => instance.id).id.must_equal instance.id
+    @driver.instance(:id => instance.id).image_id.must_equal 'ami-aecd60c7'
+    @driver.instance(:id => instance.id).name.wont_be_nil
+    @driver.instance(:id => instance.id).instance_profile.name.must_equal 't1.micro'
+    @driver.instance(:id => instance.id).realm_id.must_equal 'us-east-1a'
+    @driver.instance(:id => instance.id).owner_id.must_equal '293787749884'
+    @driver.instance(:id => instance.id).keyname.must_equal 'test1'
+    @driver.instance(:id => instance.id).firewalls.must_include 'default'
+    @driver.instance(:id => instance.id).state.must_equal 'RUNNING'
+    @driver.instance(:id => instance.id).public_addresses.wont_be_empty
+    @driver.instance(:id => instance.id).actions.must_include :reboot
+    @driver.instance(:id => instance.id).actions.must_include :stop
+    @driver.destroy_instance(instance.id)
+    instance.wait_for!(@driver, record_retries('stopped')) { |i| i.is_stopped? }
+  end
+
+  it 'must allow to create multiple instances using the "instance_count" parameter' do
+    instances = @driver.create_instance('ami-aecd60c7',
+                                       :realm_id => 'us-east-1a',
+                                       :hwp_id => 't1.micro',
+                                       :instance_count => '2'
+                                      )
+    instances.wont_be_empty
+    instances.size.must_equal 2
+    instances.each { |i| i.must_be_kind_of Instance }
+    instances = instances.map { |instance| instance.wait_for!(@driver, record_retries("#{instance.id}-running")) { |i| i.is_running? } }
+    instances.each { |i| i.is_running?.must_equal true }
+    instances.each { |i| @driver.destroy_instance(i.id) }
+    instances = instances.map { |instance| instance.wait_for!(@driver, record_retries("#{instance.id}-stopped")) { |i| i.is_stopped? } }
+    instances.each { |i| i.is_stopped?.must_equal true }
+  end
+
+  it 'must allow to reboot instance in running state' do
+    instance = @driver.create_instance('ami-aecd60c7', :realm_id => 'us-east-1a', :hwp_id => 't1.micro')
+    instance = instance.wait_for!(@driver, record_retries) { |i| i.is_running? }
+    instance.must_be_kind_of Instance
+    instance.is_running?.must_equal true
+    @driver.reboot_instance(instance.id)
+    @driver.instance(:id => instance.id).state.must_equal 'RUNNING'
+    @driver.destroy_instance(instance.id)
+    instance.wait_for!(@driver, record_retries('stopped')) { |i| i.is_stopped? }
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/ec2/keys_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/keys_test.rb b/server/tests/drivers/ec2/keys_test.rb
new file mode 100644
index 0000000..bc29fd4
--- /dev/null
+++ b/server/tests/drivers/ec2/keys_test.rb
@@ -0,0 +1,52 @@
+require 'minitest/autorun'
+
+require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
+require_relative 'common.rb'
+
+describe 'Ec2Driver Instances' do
+
+  before do
+    @driver = Deltacloud::new(:ec2, :user => 'AKIAIZ63KHGXIWDMBY6Q', :password => 'zUfBCbML2S6pXKS44eEEXw0Cf/G8z9hMSxP2hcLV')
+    VCR.insert_cassette __name__
+  end
+
+  after do
+    VCR.eject_cassette
+  end
+
+  it 'must throw error when wrong credentials' do
+    Proc.new do
+      @driver.backend.images(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
+    end.must_raise Deltacloud::ExceptionHandler::AuthenticationFailure, 'Authentication Failure'
+  end
+
+  it 'must return list of keys' do
+    @driver.keys.wont_be_empty
+    @driver.keys.first.must_be_kind_of Key
+  end
+
+  it 'must allow to filter keys' do
+    @driver.keys(:id => 'test1').wont_be_empty
+    @driver.keys(:id => 'test1').must_be_kind_of Array
+    @driver.keys(:id => 'test1').size.must_equal 1
+    @driver.keys(:id => 'test1').first.id.must_equal 'test1'
+    @driver.keys(:id => 'unknown').must_be_empty
+  end
+
+  it 'must allow to retrieve single key' do
+    @driver.key(:id => 'test1').wont_be_nil
+    @driver.key(:id => 'test1').must_be_kind_of Key
+    @driver.key(:id => 'test1').id.must_equal 'test1'
+    @driver.key(:id => 'unknown').must_be_nil
+  end
+
+  it 'must allow to create a new key' do
+    key = @driver.create_key(:key_name => 'test-key-1')
+    key.wont_be_nil
+    key.must_be_kind_of Key
+    Proc.new { @driver.create_key(:key_name => 'test-key-1') }.must_raise Deltacloud::ExceptionHandler::ProviderError, 'KeyExist'
+    @driver.destroy_key :id => key.id
+    @driver.key(:id => key.id).must_be_nil
+  end
+
+ end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/ec2/realms_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/realms_test.rb b/server/tests/drivers/ec2/realms_test.rb
new file mode 100644
index 0000000..f83ca44
--- /dev/null
+++ b/server/tests/drivers/ec2/realms_test.rb
@@ -0,0 +1,44 @@
+require 'minitest/autorun'
+
+require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
+require_relative 'common.rb'
+
+describe 'Ec2Driver Realms' do
+
+  before do
+    @driver = Deltacloud::new(:ec2, :user => 'AKIAIZ63KHGXIWDMBY6Q', :password => 'zUfBCbML2S6pXKS44eEEXw0Cf/G8z9hMSxP2hcLV')
+    VCR.insert_cassette __name__
+  end
+
+  after do
+    VCR.eject_cassette
+  end
+
+  it 'must throw error when wrong credentials' do
+    Proc.new do
+      @driver.backend.realms(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
+    end.must_raise Deltacloud::ExceptionHandler::AuthenticationFailure, 'Authentication Failure'
+  end
+
+  it 'must return list of realms' do
+    @driver.realms.wont_be_empty
+    @driver.realms.first.must_be_kind_of Realm
+  end
+
+  it 'must allow to filter realms' do
+    @driver.realms(:id => 'us-east-1a').wont_be_empty
+    @driver.realms(:id => 'us-east-1a').must_be_kind_of Array
+    @driver.realms(:id => 'us-east-1a').size.must_equal 1
+    @driver.realms(:id => 'us-east-1a').first.id.must_equal 'us-east-1a'
+    @driver.realms(:id => 'unknown').must_be_empty
+  end
+
+  it 'must allow to retrieve single realm' do
+    @driver.realm(:id => 'us-east-1a').wont_be_nil
+    @driver.realm(:id => 'us-east-1a').must_be_kind_of Realm
+    @driver.realm(:id => 'us-east-1b').id.must_equal 'us-east-1b'
+    @driver.realm(:id => 'unknown').must_be_nil
+  end
+
+end
+

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3e9b13a0/server/tests/drivers/models/instance_address_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/models/instance_address_test.rb b/server/tests/drivers/models/instance_address_test.rb
new file mode 100644
index 0000000..78ee160
--- /dev/null
+++ b/server/tests/drivers/models/instance_address_test.rb
@@ -0,0 +1,24 @@
+require 'minitest/autorun'
+
+require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'base_model.rb')
+require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'instance_address.rb')
+
+describe InstanceAddress do
+
+  before do
+    @address = InstanceAddress.new('192.168.0.1')
+  end
+
+  it 'should properly report address type' do
+    @address.address_type.must_equal :ipv4
+    @address.address.must_equal '192.168.0.1'
+    @address.is_ipv4?.must_equal true
+    InstanceAddress.new('01:23:45:67:89:ab', :type => :mac).address_type.must_equal :mac
+    InstanceAddress.new('01:23:45:67:89:ab', :type => :mac).is_mac?.must_equal true
+    InstanceAddress.new('test.local', :type => :hostname).is_hostname?.must_equal true
+    InstanceAddress.new('test.local', :port => '5000', :type => :vnc).is_vnc?.must_equal true
+    InstanceAddress.new('test.local', :port => '5000', :type => :vnc).port.must_equal '5000'
+    InstanceAddress.new('test.local', :port => '5000', :type => :vnc).to_s.must_equal 'VNC:test.local:5000'
+  end
+
+end


Mime
View raw message