mirror of https://github.com/apache/jclouds.git
fixed regressions on ec2
This commit is contained in:
parent
f9dbfda92d
commit
1858f77451
|
@ -26,6 +26,7 @@ import java.util.Set;
|
|||
|
||||
import org.jclouds.compute.BaseComputeServiceLiveTest;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.compute.predicates.NodePredicates;
|
||||
|
@ -159,12 +160,16 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
|
||||
String group = this.group + "e";
|
||||
int volumeSize = 8;
|
||||
|
||||
final Template template = context.getComputeService().templateBuilder().hardwareId(InstanceType.M1_SMALL)
|
||||
.osFamily(OsFamily.UBUNTU).osVersionMatches("10.04").imageDescriptionMatches(".*ebs.*").build();
|
||||
|
||||
Location zone = Iterables.find(context.getComputeService().listAssignableLocations(), new Predicate<Location>() {
|
||||
|
||||
@Override
|
||||
public boolean apply(Location arg0) {
|
||||
return arg0.getScope() == LocationScope.ZONE;
|
||||
return arg0.getScope() == LocationScope.ZONE
|
||||
&& arg0.getParent().getId().equals(template.getLocation().getId());
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -174,9 +179,6 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
Snapshot snapshot = ebsClient.createSnapshotInRegion(volume.getRegion(), volume.getId());
|
||||
ebsClient.deleteVolumeInRegion(volume.getRegion(), volume.getId());
|
||||
|
||||
Template template = context.getComputeService().templateBuilder().locationId(volume.getRegion()).hardwareId(
|
||||
InstanceType.M1_SMALL).imageDescriptionMatches(".*ebs.*").build();
|
||||
|
||||
template.getOptions().as(EC2TemplateOptions.class)//
|
||||
// .unmapDeviceNamed("/dev/foo)
|
||||
.mapEphemeralDeviceToDeviceName("/dev/sdm", "ephemeral0")//
|
||||
|
@ -223,8 +225,8 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
return instance;
|
||||
}
|
||||
|
||||
protected void cleanupExtendedStuff(SecurityGroupClient securityGroupClient, KeyPairClient keyPairClient, String group)
|
||||
throws InterruptedException {
|
||||
protected void cleanupExtendedStuff(SecurityGroupClient securityGroupClient, KeyPairClient keyPairClient,
|
||||
String group) throws InterruptedException {
|
||||
try {
|
||||
for (SecurityGroup secgroup : securityGroupClient.describeSecurityGroupsInRegion(null))
|
||||
if (secgroup.getName().startsWith("jclouds#" + group) || secgroup.getName().equals(group)) {
|
||||
|
|
|
@ -56,7 +56,7 @@ public class RequestSpotInstancesOptions extends BaseEC2RequestOptions {
|
|||
* time and remains active until it expires or is canceled.
|
||||
*/
|
||||
public RequestSpotInstancesOptions validFrom(Date start) {
|
||||
formParameters.put("ValidFrom", service.iso8601DateFormat(checkNotNull(start, "start")));
|
||||
formParameters.put("ValidFrom", service.iso8601SecondsDateFormat(checkNotNull(start, "start")));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class RequestSpotInstancesOptions extends BaseEC2RequestOptions {
|
|||
* persistent, it remains active until it is canceled or this date and time is reached.
|
||||
*/
|
||||
public RequestSpotInstancesOptions validUntil(Date end) {
|
||||
formParameters.put("ValidUntil", service.iso8601DateFormat(checkNotNull(end, "end")));
|
||||
formParameters.put("ValidUntil", service.iso8601SecondsDateFormat(checkNotNull(end, "end")));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ import com.google.common.collect.Sets;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", sequential = true, testName = "AWSEC2ComputeServiceLiveTest")
|
||||
@Test(groups = "live", singleThreaded = true, testName = "AWSEC2ComputeServiceLiveTest")
|
||||
public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
|
||||
|
||||
public AWSEC2ComputeServiceLiveTest() {
|
||||
|
|
|
@ -104,7 +104,7 @@ public class RequestSpotInstancesOptionsTest {
|
|||
RequestSpotInstancesOptions options = new RequestSpotInstancesOptions();
|
||||
options.validFrom(test);
|
||||
assertEquals(options.buildFormParameters().get("ValidFrom"),
|
||||
Collections.singletonList("1970-05-23T21:21:18.910Z"));
|
||||
Collections.singletonList("1970-05-23T21:21:18Z"));
|
||||
}
|
||||
|
||||
Date test = new Date(12345678910l);
|
||||
|
@ -113,7 +113,7 @@ public class RequestSpotInstancesOptionsTest {
|
|||
public void testFromStatic() {
|
||||
RequestSpotInstancesOptions options = validFrom(test);
|
||||
assertEquals(options.buildFormParameters().get("ValidFrom"),
|
||||
Collections.singletonList("1970-05-23T21:21:18.910Z"));
|
||||
Collections.singletonList("1970-05-23T21:21:18Z"));
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = NullPointerException.class)
|
||||
|
@ -126,14 +126,14 @@ public class RequestSpotInstancesOptionsTest {
|
|||
RequestSpotInstancesOptions options = new RequestSpotInstancesOptions();
|
||||
options.validUntil(test);
|
||||
assertEquals(options.buildFormParameters().get("ValidUntil"),
|
||||
Collections.singletonList("1970-05-23T21:21:18.910Z"));
|
||||
Collections.singletonList("1970-05-23T21:21:18Z"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToStatic() {
|
||||
RequestSpotInstancesOptions options = validUntil(test);
|
||||
assertEquals(options.buildFormParameters().get("ValidUntil"),
|
||||
Collections.singletonList("1970-05-23T21:21:18.910Z"));
|
||||
Collections.singletonList("1970-05-23T21:21:18Z"));
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = NullPointerException.class)
|
||||
|
|
|
@ -77,7 +77,7 @@ public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotI
|
|||
assertNonPayloadHeadersEqual(request, "Host: ec2.eu-west-1.amazonaws.com\n");
|
||||
assertPayloadEquals(
|
||||
request,
|
||||
"Version=2010-11-15&Action=RequestSpotInstances&InstanceCount=3&SpotPrice=0.01&ValidFrom=1970-05-23T21%3A21%3A18.910Z&ValidUntil=2009-02-13T23%3A31%3A31.011Z&AvailabilityZoneGroup=availabilityZoneGroup&LaunchGroup=launchGroup&LaunchSpecification.ImageId=ami-voo&LaunchSpecification.Placement.AvailabilityZone=eu-west-1a&LaunchSpecification.SecurityGroup.1=group1&LaunchSpecification.InstanceType=m1.small&LaunchSpecification.KernelId=kernelId",
|
||||
"Version=2010-11-15&Action=RequestSpotInstances&InstanceCount=3&SpotPrice=0.01&ValidFrom=1970-05-23T21%3A21%3A18Z&ValidUntil=2009-02-13T23%3A31%3A31Z&AvailabilityZoneGroup=availabilityZoneGroup&LaunchGroup=launchGroup&LaunchSpecification.ImageId=ami-voo&LaunchSpecification.Placement.AvailabilityZone=eu-west-1a&LaunchSpecification.SecurityGroup.1=group1&LaunchSpecification.InstanceType=m1.small&LaunchSpecification.KernelId=kernelId",
|
||||
"application/x-www-form-urlencoded", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
|
|
|
@ -62,7 +62,7 @@ import com.google.inject.Module;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", sequential = true)
|
||||
@Test(groups = "live", singleThreaded = true)
|
||||
public class SpotInstanceClientLiveTest {
|
||||
|
||||
private static final int SPOT_DELAY_SECONDS = 300;
|
||||
|
@ -141,8 +141,9 @@ public class SpotInstanceClientLiveTest {
|
|||
assertEquals(spot.getRegion(), region);
|
||||
assert in(ImmutableSet.of("Linux/UNIX", "SUSE Linux", "Windows")).apply(spot.getProductDescription()) : spot;
|
||||
assert in(
|
||||
ImmutableSet.of("c1.medium", "c1.xlarge", "cc1.4xlarge", "cg1.4xlarge", "m1.large", "m1.small", "m1.xlarge",
|
||||
"m2.2xlarge", "m2.4xlarge", "m2.xlarge", "t1.micro")).apply(spot.getInstanceType()) : spot;
|
||||
ImmutableSet.of("c1.medium", "c1.xlarge", "cc1.4xlarge", "cg1.4xlarge", "m1.large", "m1.small",
|
||||
"m1.xlarge", "m2.2xlarge", "m2.4xlarge", "m2.xlarge", "t1.micro")).apply(
|
||||
spot.getInstanceType()) : spot;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +164,8 @@ public class SpotInstanceClientLiveTest {
|
|||
0.03f,
|
||||
1,
|
||||
LaunchSpecification.builder().imageId("ami-595a0a1c").instanceType(InstanceType.T1_MICRO).build(),
|
||||
launchGroup(launchGroup).availabilityZoneGroup(launchGroup).validFrom(new Date()).validUntil(
|
||||
launchGroup(launchGroup).availabilityZoneGroup(launchGroup).validFrom(
|
||||
new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(1))).validUntil(
|
||||
new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(SPOT_DELAY_SECONDS))));
|
||||
assertNotNull(requests);
|
||||
|
||||
|
|
Loading…
Reference in New Issue