fixed tests and virtualizationType for ec2

This commit is contained in:
Adrian Cole 2010-07-17 22:33:00 -07:00
parent d626a9848e
commit 889f47078d
5 changed files with 21 additions and 17 deletions

View File

@ -373,7 +373,8 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
} }
}); });
for (String zone : availabilityZoneToRegionMap.keySet()) { for (String zone : availabilityZoneToRegionMap.keySet()) {
locations.add(new LocationImpl(LocationScope.ZONE, zone, zone, idToLocation.get(zone))); locations.add(new LocationImpl(LocationScope.ZONE, zone, zone, idToLocation.get(availabilityZoneToRegionMap
.get(zone))));
} }
return locations; return locations;
} }

View File

@ -236,7 +236,7 @@ public abstract class BaseReservationHandler<T> extends HandlerForGeneratedReque
region = defaultRegion; region = defaultRegion;
instances.add(new RunningInstance(region, groupIds, amiLaunchIndex, dnsName, imageId, instanceId, instances.add(new RunningInstance(region, groupIds, amiLaunchIndex, dnsName, imageId, instanceId,
instanceState, instanceType, ipAddress, kernelId, keyName, launchTime, monitoring, availabilityZone, instanceState, instanceType, ipAddress, kernelId, keyName, launchTime, monitoring, availabilityZone,
placementGroup, platform, privateDnsName, privateIpAddress, virtualizationType, productCodes, placementGroup, virtualizationType, platform, privateDnsName, privateIpAddress, productCodes,
ramdiskId, reason, subnetId, vpcId, rootDeviceType, rootDeviceName, ebsBlockDevices)); ramdiskId, reason, subnetId, vpcId, rootDeviceType, rootDeviceName, ebsBlockDevices));
this.amiLaunchIndex = null; this.amiLaunchIndex = null;
this.dnsName = null; this.dnsName = null;

View File

@ -184,11 +184,12 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
assertEquals(instance.getKeyName(), null); assertEquals(instance.getKeyName(), null);
// make sure we made our dummy group and also let in the user's group // make sure we made our dummy group and also let in the user's group
assertEquals(instance.getGroupIds(), ImmutableSet.<String> of(tag, "jclouds#" + tag)); assertEquals(instance.getGroupIds(), ImmutableSet.<String> of(tag, String.format("jclouds#%s#%s", tag,
instance.getRegion())));
// make sure our dummy group has no rules // make sure our dummy group has no rules
SecurityGroup group = Iterables.getOnlyElement(securityGroupClient.describeSecurityGroupsInRegion(null, SecurityGroup group = Iterables.getOnlyElement(securityGroupClient.describeSecurityGroupsInRegion(null, String
"jclouds#" + tag)); .format("jclouds#%s#%s", tag, instance.getRegion())));
assert group.getIpPermissions().size() == 0 : group; assert group.getIpPermissions().size() == 0 : group;
} finally { } finally {
@ -268,7 +269,8 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
return instance; return instance;
} }
private void cleanupExtendedStuff(SecurityGroupClient securityGroupClient, KeyPairClient keyPairClient, String tag) { private void cleanupExtendedStuff(SecurityGroupClient securityGroupClient, KeyPairClient keyPairClient, String tag)
throws InterruptedException {
try { try {
securityGroupClient.deleteSecurityGroupInRegion(null, tag); securityGroupClient.deleteSecurityGroupInRegion(null, tag);
} catch (Exception e) { } catch (Exception e) {
@ -279,6 +281,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
} catch (Exception e) { } catch (Exception e) {
} }
Thread.sleep(2000);
} }
} }

View File

@ -73,8 +73,8 @@ public class DescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest {
"ec2-174-129-81-68.compute-1.amazonaws.com", "ami-1fd73376", "i-0799056f", "ec2-174-129-81-68.compute-1.amazonaws.com", "ami-1fd73376", "i-0799056f",
InstanceState.RUNNING, InstanceType.M1_SMALL, "174.129.81.68", "aki-a71cf9ce", InstanceState.RUNNING, InstanceType.M1_SMALL, "174.129.81.68", "aki-a71cf9ce",
"adriancole.ec21", dateService.iso8601DateParse("2009-11-09T03:00:34.000Z"), false, "adriancole.ec21", dateService.iso8601DateParse("2009-11-09T03:00:34.000Z"), false,
AvailabilityZone.US_EAST_1C, null, null, "ip-10-243-42-70.ec2.internal", "10.243.42.70", AvailabilityZone.US_EAST_1C, null, "paravirtual", null, "ip-10-243-42-70.ec2.internal",
"paravirtual", ImmutableSet.<String> of(), "ari-a51cf9cc", null, null, null, "10.243.42.70", ImmutableSet.<String> of(), "ari-a51cf9cc", null, null, null,
RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of())), RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of())),
"993194456877", null, "r-a3c508cb")); "993194456877", null, "r-a3c508cb"));
@ -92,13 +92,13 @@ public class DescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest {
defaultRegion, ImmutableSet.of("default"), "23", "ec2-72-44-33-4.compute-1.amazonaws.com", defaultRegion, ImmutableSet.of("default"), "23", "ec2-72-44-33-4.compute-1.amazonaws.com",
"ami-6ea54007", "i-28a64341", InstanceState.RUNNING, InstanceType.M1_LARGE, (String) null, "ami-6ea54007", "i-28a64341", InstanceState.RUNNING, InstanceType.M1_LARGE, (String) null,
"aki-ba3adfd3", "example-key-name", dateService.iso8601DateParse("2007-08-07T11:54:42.000Z"), false, "aki-ba3adfd3", "example-key-name", dateService.iso8601DateParse("2007-08-07T11:54:42.000Z"), false,
AvailabilityZone.US_EAST_1B, null, null, "10-251-50-132.ec2.internal", null, "paravirtual", ImmutableSet AvailabilityZone.US_EAST_1B, null, "paravirtual", null, "10-251-50-132.ec2.internal", null, ImmutableSet
.of("774F4FF8"), "ari-badbad00", null, null, null, RootDeviceType.INSTANCE_STORE, null, .of("774F4FF8"), "ari-badbad00", null, null, null, RootDeviceType.INSTANCE_STORE, null,
ImmutableMap.<String, EbsBlockDevice> of()), new RunningInstance(defaultRegion, ImmutableSet ImmutableMap.<String, EbsBlockDevice> of()), new RunningInstance(defaultRegion, ImmutableSet
.of("default"), "23", "ec2-72-44-33-6.compute-1.amazonaws.com", "ami-6ea54007", "i-28a64435", .of("default"), "23", "ec2-72-44-33-6.compute-1.amazonaws.com", "ami-6ea54007", "i-28a64435",
InstanceState.RUNNING, InstanceType.M1_LARGE, (String) null, "aki-ba3adfd3", "example-key-name", InstanceState.RUNNING, InstanceType.M1_LARGE, (String) null, "aki-ba3adfd3", "example-key-name",
dateService.iso8601DateParse("2007-08-07T11:54:42.000Z"), false, AvailabilityZone.US_EAST_1B, null, dateService.iso8601DateParse("2007-08-07T11:54:42.000Z"), false, AvailabilityZone.US_EAST_1B, null,
null, "10-251-50-134.ec2.internal", null, "paravirtual", ImmutableSet.of("774F4FF8"), "ari-badbad00", "paravirtual", null, "10-251-50-134.ec2.internal", null, ImmutableSet.of("774F4FF8"), "ari-badbad00",
null, null, null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of())), null, null, null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of())),
"UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM", null, "r-44a5402d")); "UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM", null, "r-44a5402d"));
@ -117,8 +117,8 @@ public class DescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest {
contents.add(new Reservation(defaultRegion, ImmutableSet.of("default"), ImmutableSet.of(new RunningInstance( contents.add(new Reservation(defaultRegion, ImmutableSet.of("default"), ImmutableSet.of(new RunningInstance(
defaultRegion, ImmutableSet.of("jclouds#euc"), "1", null, "emi-9ACB1363", "i-3FFA0762", defaultRegion, ImmutableSet.of("jclouds#euc"), "1", null, "emi-9ACB1363", "i-3FFA0762",
InstanceState.SHUTTING_DOWN, InstanceType.M1_LARGE, null, "eki-6CBD12F2", "jclouds#euc-17", dateService InstanceState.SHUTTING_DOWN, InstanceType.M1_LARGE, null, "eki-6CBD12F2", "jclouds#euc-17", dateService
.iso8601DateParse("2010-06-16T03:06:19.000Z"), false, "open", null, null, "10.7.0.179", null, .iso8601DateParse("2010-06-16T03:06:19.000Z"), false, "open", null, "paravirtual", null,
"paravirtual", ImmutableSet.<String> of(), "eri-A97113E4", null, null, null, "10.7.0.179", null, ImmutableSet.<String> of(), "eri-A97113E4", null, null, null,
RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of())), "jclouds", null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of())), "jclouds", null,
"r-4D2A08AD")); "r-4D2A08AD"));
@ -137,8 +137,8 @@ public class DescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest {
"ec2-75-101-203-146.compute-1.amazonaws.com", "ami-849875ed", "i-e564438d", "ec2-75-101-203-146.compute-1.amazonaws.com", "ami-849875ed", "i-e564438d",
InstanceState.RUNNING, InstanceType.M1_SMALL, "75.101.203.146", "aki-a71cf9ce", InstanceState.RUNNING, InstanceType.M1_SMALL, "75.101.203.146", "aki-a71cf9ce",
"adriancole.ec2ebs1", dateService.iso8601DateParse("2009-12-30T04:06:23.000Z"), false, "adriancole.ec2ebs1", dateService.iso8601DateParse("2009-12-30T04:06:23.000Z"), false,
AvailabilityZone.US_EAST_1B, "placement", null, "domU-12-31-39-09-CE-53.compute-1.internal", AvailabilityZone.US_EAST_1B, "placement","hvm", null, "domU-12-31-39-09-CE-53.compute-1.internal",
"10.210.209.157", "hvm", ImmutableSet.<String> of(), "ari-a51cf9cc", null, null, null, "10.210.209.157", ImmutableSet.<String> of(), "ari-a51cf9cc", null, null, null,
RootDeviceType.EBS, "/dev/sda1", ImmutableMap.<String, EbsBlockDevice> of("/dev/sda1", RootDeviceType.EBS, "/dev/sda1", ImmutableMap.<String, EbsBlockDevice> of("/dev/sda1",
new EbsBlockDevice("vol-dc6ca8b5", Attachment.Status.ATTACHED, dateService new EbsBlockDevice("vol-dc6ca8b5", Attachment.Status.ATTACHED, dateService
.iso8601DateParse("2009-12-30T04:06:29.000Z"), true)))), "993194456877", .iso8601DateParse("2009-12-30T04:06:29.000Z"), true)))), "993194456877",

View File

@ -68,17 +68,17 @@ public class RunInstancesResponseHandlerTest extends BaseEC2HandlerTest {
new RunningInstance(defaultRegion, ImmutableSet.of("default"), "0", null, "ami-60a54009", "i-2ba64342", new RunningInstance(defaultRegion, ImmutableSet.of("default"), "0", null, "ami-60a54009", "i-2ba64342",
InstanceState.PENDING, InstanceType.M1_SMALL, (String) null, null, "example-key-name", InstanceState.PENDING, InstanceType.M1_SMALL, (String) null, null, "example-key-name",
dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"), true, AvailabilityZone.US_EAST_1B, dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"), true, AvailabilityZone.US_EAST_1B,
null, null, (String) null, null, "paravirtual", Sets.<String> newLinkedHashSet(), null, null, null, "paravirtual", null, (String) null, null, Sets.<String> newLinkedHashSet(), null, null,
null, null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of()), null, null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of()),
new RunningInstance(defaultRegion, ImmutableSet.of("default"), "1", null, "ami-60a54009", "i-2bc64242", new RunningInstance(defaultRegion, ImmutableSet.of("default"), "1", null, "ami-60a54009", "i-2bc64242",
InstanceState.PENDING, InstanceType.M1_SMALL, (String) null, null, "example-key-name", InstanceState.PENDING, InstanceType.M1_SMALL, (String) null, null, "example-key-name",
dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"), true, AvailabilityZone.US_EAST_1B, dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"), true, AvailabilityZone.US_EAST_1B,
null, null, (String) null, null, "paravirtual", Sets.<String> newLinkedHashSet(), null, null, null, "paravirtual", null, (String) null, null, Sets.<String> newLinkedHashSet(), null, null,
null, null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of()), null, null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of()),
new RunningInstance(defaultRegion, ImmutableSet.of("default"), "2", null, "ami-60a54009", "i-2be64332", new RunningInstance(defaultRegion, ImmutableSet.of("default"), "2", null, "ami-60a54009", "i-2be64332",
InstanceState.PENDING, InstanceType.M1_SMALL, (String) null, null, "example-key-name", InstanceState.PENDING, InstanceType.M1_SMALL, (String) null, null, "example-key-name",
dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"), true, AvailabilityZone.US_EAST_1B, dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"), true, AvailabilityZone.US_EAST_1B,
null, null, (String) null, null, "paravirtual", Sets.<String> newLinkedHashSet(), null, null, null, "paravirtual", null, (String) null, null, Sets.<String> newLinkedHashSet(), null, null,
null, null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of()) null, null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of())
), "AIDADH4IGTRXXKCD", null, "r-47a5402e"); ), "AIDADH4IGTRXXKCD", null, "r-47a5402e");