ec2 test stabilization

This commit is contained in:
Adrian Cole 2011-10-04 02:21:51 -07:00
parent fb86273dd9
commit f326be00f8
4 changed files with 13 additions and 13 deletions

View File

@ -88,7 +88,7 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
.build(); .build();
assert (template.getImage().getProviderId().startsWith("ami-")) : template; assert (template.getImage().getProviderId().startsWith("ami-")) : template;
assertEquals(template.getImage().getOperatingSystem().getVersion(), "11.04"); assertEquals(template.getImage().getOperatingSystem().getVersion(), "11.10");
assertEquals(template.getImage().getOperatingSystem().is64Bit(), false); assertEquals(template.getImage().getOperatingSystem().is64Bit(), false);
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
@ -107,7 +107,7 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
.build(); .build();
assert (template.getImage().getProviderId().startsWith("ami-")) : template; assert (template.getImage().getProviderId().startsWith("ami-")) : template;
assertEquals(template.getImage().getOperatingSystem().getVersion(), "11.04"); assertEquals(template.getImage().getOperatingSystem().getVersion(), "11.10");
assertEquals(template.getImage().getOperatingSystem().is64Bit(), false); assertEquals(template.getImage().getOperatingSystem().is64Bit(), false);
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
@ -183,7 +183,7 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
fastestTemplate = context.getComputeService().templateBuilder().fastest().build(); fastestTemplate = context.getComputeService().templateBuilder().fastest().build();
assert (fastestTemplate.getImage().getProviderId().startsWith("ami-")) : fastestTemplate; assert (fastestTemplate.getImage().getProviderId().startsWith("ami-")) : fastestTemplate;
assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.CC1_4XLARGE); assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.CC1_4XLARGE);
assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "11.04"); assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "11.10");
assertEquals(fastestTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(fastestTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(fastestTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(fastestTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(fastestTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs"); assertEquals(fastestTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");

View File

@ -144,7 +144,7 @@ public class AMIClientLiveTest {
.put("root-device-type", "ebs")// .put("root-device-type", "ebs")//
.build()).ownedBy("137112412989", "099720109477")); .build()).ownedBy("137112412989", "099720109477"));
assertNotNull(twoResults); assertNotNull(twoResults);
assertEquals(twoResults.size(), 31); assertEquals(twoResults.size(), 33);
} }
@Test(enabled = false) @Test(enabled = false)

View File

@ -132,12 +132,12 @@ public class AWSKeyPairClientLiveTest {
NodeMetadata first = get(nodes, 0); NodeMetadata first = get(nodes, 0);
assert first.getCredentials() != null : first; assert first.getCredentials() != null : first;
assert first.getCredentials().identity != null : first; assert first.getCredentials().identity != null : first;
assert first.getCredentials().credential == null : first;
AWSRunningInstance instance = getInstance(instanceClient, first.getProviderId()); AWSRunningInstance instance = getInstance(instanceClient, first.getProviderId());
assert instance.getSpotInstanceRequestId() != null : instance; assert instance.getSpotInstanceRequestId() != null : instance;
assertEquals(instance.getKeyName(), "jclouds#" + group); assertEquals(instance.getKeyName(), "jclouds#" + group);
assertEquals(first.getCredentials().credential, null);
Map<? extends NodeMetadata, ExecResponse> responses = computeContext.getComputeService() Map<? extends NodeMetadata, ExecResponse> responses = computeContext.getComputeService()
.runScriptOnNodesMatching( .runScriptOnNodesMatching(

View File

@ -23,13 +23,11 @@ import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Sets.newTreeSet; import static com.google.common.collect.Sets.newTreeSet;
import static org.jclouds.compute.ComputeTestUtils.buildScript; import static org.jclouds.compute.ComputeTestUtils.buildScript;
import static org.jclouds.compute.ComputeTestUtils.setupKeyPair;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
@ -46,11 +44,14 @@ import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.RunNodesException; import org.jclouds.compute.RunNodesException;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.Template;
import org.jclouds.compute.predicates.NodePredicates; import org.jclouds.compute.predicates.NodePredicates;
import org.jclouds.ec2.domain.InstanceType; import org.jclouds.ec2.domain.InstanceType;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.predicates.RetryablePredicate; import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.scriptbuilder.domain.Statements;
import org.jclouds.scriptbuilder.statements.login.AdminAccess;
import org.jclouds.sshj.config.SshjSshClientModule; import org.jclouds.sshj.config.SshjSshClientModule;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
@ -74,7 +75,6 @@ public class PlacementGroupClientLiveTest {
private RetryablePredicate<PlacementGroup> availableTester; private RetryablePredicate<PlacementGroup> availableTester;
private RetryablePredicate<PlacementGroup> deletedTester; private RetryablePredicate<PlacementGroup> deletedTester;
private PlacementGroup group; private PlacementGroup group;
private Map<String, String> keyPair;
protected String provider = "aws-ec2"; protected String provider = "aws-ec2";
protected String identity; protected String identity;
protected String credential; protected String credential;
@ -109,7 +109,6 @@ public class PlacementGroupClientLiveTest {
Properties overrides = setupProperties(); Properties overrides = setupProperties();
context = new ComputeServiceContextFactory().createContext(provider, context = new ComputeServiceContextFactory().createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides); ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides);
keyPair = setupKeyPair();
client = AWSEC2Client.class.cast(context.getProviderSpecificContext().getApi()); client = AWSEC2Client.class.cast(context.getProviderSpecificContext().getApi());
@ -168,15 +167,16 @@ public class PlacementGroupClientLiveTest {
public void testStartCCInstance() throws Exception { public void testStartCCInstance() throws Exception {
Template template = context.getComputeService().templateBuilder().fastest().osDescriptionMatches(".*/ubuntu-images/.*").osVersionMatches("11.04").build(); Template template = context.getComputeService().templateBuilder().fastest().osFamily(OsFamily.AMZN_LINUX).build();
assert template != null : "The returned template was null, but it should have a value."; assert template != null : "The returned template was null, but it should have a value.";
assertEquals(template.getHardware().getProviderId(), InstanceType.CC1_4XLARGE); assertEquals(template.getHardware().getProviderId(), InstanceType.CC1_4XLARGE);
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "ebs"); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
assertEquals(template.getImage().getUserMetadata().get("virtualizationType"), "hvm"); assertEquals(template.getImage().getUserMetadata().get("virtualizationType"), "hvm");
assertEquals(template.getImage().getUserMetadata().get("hypervisor"), "xen"); assertEquals(template.getImage().getUserMetadata().get("hypervisor"), "xen");
template.getOptions().overrideLoginCredentialWith(keyPair.get("private")) template.getOptions().runScript(
.authorizePublicKey(keyPair.get("public")).runScript(buildScript(template.getImage().getOperatingSystem())); Statements.newStatementList(AdminAccess.standard(),
buildScript(template.getImage().getOperatingSystem())));
String group = PREFIX + "cccluster"; String group = PREFIX + "cccluster";
context.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group)); context.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));