Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(153)

Unified Diff: ec2/ec2_test.go

Issue 60620043: ec2: Added NIC support for RunInstances (Closed)
Patch Set: ec2: Added NIC support for RunInstances Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ec2/ec2.go ('k') | ec2/ec2t_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ec2/ec2_test.go
=== modified file 'ec2/ec2_test.go'
--- ec2/ec2_test.go 2014-02-05 13:19:43 +0000
+++ ec2/ec2_test.go 2014-02-12 17:04:23 +0000
@@ -105,7 +105,33 @@
DeleteOnTermination: true,
IOPS: 1000,
}},
+ NetworkInterfaces: []ec2.RunNetworkInterface{{
+ DeviceIndex: 0,
+ SubnetId: "subnet-id",
+ Description: "eth0",
+ PrivateIPs: []ec2.PrivateIP{
+ {Address: "10.0.0.25", IsPrimary: true},
+ },
+ DeleteOnTermination: true,
+ SecurityGroupIds: []string{"sg-1", "sg-2"},
+ SecondaryPrivateIPCount: 2,
+ }, {
+ Id: "eni-id",
+ DeviceIndex: 1,
+ PrivateIPs: []ec2.PrivateIP{{
+ Address: "10.0.1.10",
+ IsPrimary: true,
+ }, {
+ Address: "10.0.1.20",
+ IsPrimary: false,
+ }},
+ }},
}
+ params := ec2.PrepareRunParams(options)
+ c.Assert(params, DeepEquals, map[string]string{
+ "Version": "2013-10-15",
+ "Action": "RunInstances",
+ })
resp, err := s.ec2.RunInstances(&options)
req := testServer.WaitRequest()
@@ -136,6 +162,19 @@
c.Assert(req.Form["BlockDeviceMapping.1.Ebs.VolumeSize"], DeepEquals, []string{"10"})
c.Assert(req.Form["BlockDeviceMapping.1.Ebs.Iops"], DeepEquals, []string{"1000"})
c.Assert(req.Form["BlockDeviceMapping.1.Ebs.DeleteOnTermination"], DeepEquals, []string{"true"})
+ c.Assert(req.Form["NetworkInterface.0.DeviceIndex"], DeepEquals, []string{"0"})
+ c.Assert(req.Form["NetworkInterface.0.SubnetId"], DeepEquals, []string{"subnet-id"})
+ c.Assert(req.Form["NetworkInterface.0.Description"], DeepEquals, []string{"eth0"})
+ c.Assert(req.Form["NetworkInterface.0.SecurityGroupId.1"], DeepEquals, []string{"sg-1"})
+ c.Assert(req.Form["NetworkInterface.0.SecurityGroupId.2"], DeepEquals, []string{"sg-2"})
+ c.Assert(req.Form["NetworkInterface.0.DeleteOnTermination"], DeepEquals, []string{"true"})
+ c.Assert(req.Form["NetworkInterface.0.SecondaryPrivateIpAddressCount"], DeepEquals, []string{"2"})
+ c.Assert(req.Form["NetworkInterface.1.NetworkInterfaceId"], DeepEquals, []string{"eni-id"})
+ c.Assert(req.Form["NetworkInterface.1.DeviceIndex"], DeepEquals, []string{"1"})
+ c.Assert(req.Form["NetworkInterface.1.PrivateIpAddresses.0.PrivateIpAddress"], DeepEquals, []string{"10.0.1.10"})
+ c.Assert(req.Form["NetworkInterface.1.PrivateIpAddresses.0.Primary"], DeepEquals, []string{"true"})
+ c.Assert(req.Form["NetworkInterface.1.PrivateIpAddresses.1.PrivateIpAddress"], DeepEquals, []string{"10.0.1.20"})
+ c.Assert(req.Form["NetworkInterface.1.PrivateIpAddresses.1.Primary"], DeepEquals, []string{"false"})
c.Assert(err, IsNil)
c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE")
@@ -153,6 +192,53 @@
c.Assert(i0.AMILaunchIndex, Equals, 0)
c.Assert(i0.VirtType, Equals, "paravirtual")
c.Assert(i0.Hypervisor, Equals, "xen")
+ c.Assert(i0.SubnetId, Equals, "subnet-id")
+ c.Assert(i0.VPCId, Equals, "vpc-id")
+ c.Assert(i0.NetworkInterfaces, HasLen, 2)
+ c.Assert(i0.NetworkInterfaces, DeepEquals, []ec2.NetworkInterface{{
+ Id: "eni-c6bb50ae",
+ SubnetId: "subnet-id",
+ VPCId: "vpc-id",
+ Description: "eth0",
+ SourceDestCheck: true,
+ OwnerId: "111122223333",
+ Status: "in-use",
+ Groups: []ec2.SecurityGroup{
+ {Name: "vpc sg-1", Id: "sg-1"},
+ {Name: "vpc sg-2", Id: "sg-2"},
+ },
+ MACAddress: "11:22:33:44:55:66",
+ PrivateIPAddress: "10.0.0.25",
+ PrivateIPs: []ec2.PrivateIP{{Address: "10.0.0.25", IsPrimary: true}},
+ Attachment: ec2.NetworkInterfaceAttachment{
+ Id: "eni-attach-0326646a",
+ DeviceIndex: 0,
+ Status: "attaching",
+ AttachTime: "2011-12-20T08:29:31.000Z",
+ DeleteOnTermination: true,
+ },
+ }, {
+ Id: "eni-id",
+ SubnetId: "subnet-id",
+ VPCId: "vpc-id",
+ SourceDestCheck: true,
+ OwnerId: "111122223333",
+ Status: "in-use",
+ Groups: []ec2.SecurityGroup{{Name: "vpc default", Id: "sg-id"}},
+ MACAddress: "11:22:33:44:55:66",
+ PrivateIPAddress: "10.0.1.10",
+ PrivateIPs: []ec2.PrivateIP{
+ {Address: "10.0.1.10", IsPrimary: true},
+ {Address: "10.0.1.20", IsPrimary: false},
+ },
+ Attachment: ec2.NetworkInterfaceAttachment{
+ Id: "eni-attach-id",
+ DeviceIndex: 1,
+ Status: "attaching",
+ AttachTime: "2011-12-20T08:29:31.000Z",
+ DeleteOnTermination: false,
+ },
+ }})
i1 := resp.Instances[1]
c.Assert(i1.InstanceId, Equals, "i-2bc64242")
« no previous file with comments | « ec2/ec2.go ('k') | ec2/ec2t_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b