From f326be00f84e41012fe820e905ea2c2f684ca8bb Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Tue, 4 Oct 2011 02:21:51 -0700 Subject: [PATCH] ec2 test stabilization --- .../compute/AWSEC2TemplateBuilderLiveTest.java | 6 +++--- .../aws/ec2/services/AMIClientLiveTest.java | 2 +- .../ec2/services/AWSKeyPairClientLiveTest.java | 2 +- .../services/PlacementGroupClientLiveTest.java | 16 ++++++++-------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2TemplateBuilderLiveTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2TemplateBuilderLiveTest.java index 86d3ac3a73..904da5063d 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2TemplateBuilderLiveTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2TemplateBuilderLiveTest.java @@ -88,7 +88,7 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { .build(); 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().getFamily(), OsFamily.UBUNTU); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); @@ -107,7 +107,7 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { .build(); 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().getFamily(), OsFamily.UBUNTU); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); @@ -183,7 +183,7 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { fastestTemplate = context.getComputeService().templateBuilder().fastest().build(); assert (fastestTemplate.getImage().getProviderId().startsWith("ami-")) : fastestTemplate; 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().getFamily(), OsFamily.UBUNTU); assertEquals(fastestTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs"); diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AMIClientLiveTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AMIClientLiveTest.java index 003aa50920..57de3a3e20 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AMIClientLiveTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AMIClientLiveTest.java @@ -144,7 +144,7 @@ public class AMIClientLiveTest { .put("root-device-type", "ebs")// .build()).ownedBy("137112412989", "099720109477")); assertNotNull(twoResults); - assertEquals(twoResults.size(), 31); + assertEquals(twoResults.size(), 33); } @Test(enabled = false) diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSKeyPairClientLiveTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSKeyPairClientLiveTest.java index 82328e349a..d555060648 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSKeyPairClientLiveTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSKeyPairClientLiveTest.java @@ -132,12 +132,12 @@ public class AWSKeyPairClientLiveTest { NodeMetadata first = get(nodes, 0); assert first.getCredentials() != null : first; assert first.getCredentials().identity != null : first; + assert first.getCredentials().credential == null : first; AWSRunningInstance instance = getInstance(instanceClient, first.getProviderId()); assert instance.getSpotInstanceRequestId() != null : instance; assertEquals(instance.getKeyName(), "jclouds#" + group); - assertEquals(first.getCredentials().credential, null); Map responses = computeContext.getComputeService() .runScriptOnNodesMatching( diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/PlacementGroupClientLiveTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/PlacementGroupClientLiveTest.java index c1e061de9b..06d69eb8a9 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/PlacementGroupClientLiveTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/PlacementGroupClientLiveTest.java @@ -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.Sets.newTreeSet; 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.assertNotNull; import java.io.FileNotFoundException; import java.io.IOException; -import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.SortedSet; @@ -46,11 +44,14 @@ import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.RunNodesException; import org.jclouds.compute.domain.NodeMetadata; +import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.Template; import org.jclouds.compute.predicates.NodePredicates; import org.jclouds.ec2.domain.InstanceType; import org.jclouds.logging.log4j.config.Log4JLoggingModule; 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.testng.annotations.AfterTest; import org.testng.annotations.BeforeClass; @@ -74,7 +75,6 @@ public class PlacementGroupClientLiveTest { private RetryablePredicate availableTester; private RetryablePredicate deletedTester; private PlacementGroup group; - private Map keyPair; protected String provider = "aws-ec2"; protected String identity; protected String credential; @@ -109,7 +109,6 @@ public class PlacementGroupClientLiveTest { Properties overrides = setupProperties(); context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet. of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides); - keyPair = setupKeyPair(); client = AWSEC2Client.class.cast(context.getProviderSpecificContext().getApi()); @@ -168,15 +167,16 @@ public class PlacementGroupClientLiveTest { 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."; assertEquals(template.getHardware().getProviderId(), InstanceType.CC1_4XLARGE); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "ebs"); assertEquals(template.getImage().getUserMetadata().get("virtualizationType"), "hvm"); assertEquals(template.getImage().getUserMetadata().get("hypervisor"), "xen"); - - template.getOptions().overrideLoginCredentialWith(keyPair.get("private")) - .authorizePublicKey(keyPair.get("public")).runScript(buildScript(template.getImage().getOperatingSystem())); + + template.getOptions().runScript( + Statements.newStatementList(AdminAccess.standard(), + buildScript(template.getImage().getOperatingSystem()))); String group = PREFIX + "cccluster"; context.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));