fixed broked live tests

This commit is contained in:
Adrian Cole 2010-11-07 02:01:15 +01:00
parent f4b0ce9b7d
commit 044ffc8563
10 changed files with 123 additions and 75 deletions

View File

@ -89,7 +89,7 @@ public class EC2TemplateBuilderLiveTest {
assertEquals(template.getImage().getOperatingSystem().getVersion(), "10.10"); assertEquals(template.getImage().getOperatingSystem().getVersion(), "10.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().getVersion(), "20101027"); assertEquals(template.getImage().getVersion(), "20101106");
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
assertEquals(template.getLocation().getId(), "us-east-1"); assertEquals(template.getLocation().getId(), "us-east-1");
assertEquals(getCores(template.getHardware()), 1.0d); assertEquals(getCores(template.getHardware()), 1.0d);

View File

@ -45,6 +45,12 @@ public class EucalyptusComputeServiceLiveTest extends EC2ComputeServiceLiveTest
tag = "euc"; tag = "euc";
} }
@Override
@Test(enabled = false)
public void testExtendedOptionsAndLogin() throws Exception {
// euc does not support monitoring
}
@Override @Override
protected void assertDefaultWorks() { protected void assertDefaultWorks() {
Template defaultTemplate = client.templateBuilder().build(); Template defaultTemplate = client.templateBuilder().build();

View File

@ -36,12 +36,13 @@ import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2AsyncClient; import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client; import org.jclouds.aws.ec2.EC2Client;
import org.jclouds.aws.ec2.domain.Image; import org.jclouds.aws.ec2.domain.Image;
import org.jclouds.aws.ec2.domain.RootDeviceType;
import org.jclouds.aws.ec2.domain.Image.ImageType; import org.jclouds.aws.ec2.domain.Image.ImageType;
import org.jclouds.aws.ec2.domain.RootDeviceType;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -74,13 +75,12 @@ public class AMIClientLiveTest {
protected String endpoint; protected String endpoint;
protected String apiversion; protected String apiversion;
@BeforeClass
protected void setupCredentials() { protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity"); identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider credential = System.getProperty("test." + provider + ".credential");
+ ".credential"); endpoint = System.getProperty("test." + provider + ".endpoint");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint"); apiversion = System.getProperty("test." + provider + ".apiversion");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
} }
protected Properties setupProperties() { protected Properties setupProperties() {
@ -88,9 +88,12 @@ public class AMIClientLiveTest {
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity); overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential); if (credential != null)
overrides.setProperty(provider + ".endpoint", endpoint); overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(provider + ".apiversion", apiversion); if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiversion != null)
overrides.setProperty(provider + ".apiversion", apiversion);
return overrides; return overrides;
} }

View File

@ -27,10 +27,10 @@ import static org.testng.Assert.assertNotNull;
import java.net.URI; import java.net.URI;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.Map.Entry;
import org.jclouds.Constants; import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
@ -41,13 +41,13 @@ import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.inject.Module; import com.google.inject.Module;
/** /**
@ -66,13 +66,12 @@ public class AvailabilityZoneAndRegionClientLiveTest {
protected String endpoint; protected String endpoint;
protected String apiversion; protected String apiversion;
@BeforeClass
protected void setupCredentials() { protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity"); identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider credential = System.getProperty("test." + provider + ".credential");
+ ".credential"); endpoint = System.getProperty("test." + provider + ".endpoint");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint"); apiversion = System.getProperty("test." + provider + ".apiversion");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
} }
protected Properties setupProperties() { protected Properties setupProperties() {
@ -80,9 +79,12 @@ public class AvailabilityZoneAndRegionClientLiveTest {
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity); overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential); if (credential != null)
overrides.setProperty(provider + ".endpoint", endpoint); overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(provider + ".apiversion", apiversion); if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiversion != null)
overrides.setProperty(provider + ".apiversion", apiversion);
return overrides; return overrides;
} }
@ -90,26 +92,25 @@ public class AvailabilityZoneAndRegionClientLiveTest {
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();
Properties overrides = setupProperties(); Properties overrides = setupProperties();
context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()), context = new ComputeServiceContextFactory().createContext(provider,
overrides).getProviderSpecificContext(); ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getProviderSpecificContext();
client = context.getApi().getAvailabilityZoneAndRegionServices(); client = context.getApi().getAvailabilityZoneAndRegionServices();
} }
public void testDescribeAvailabilityZones() { public void testDescribeAvailabilityZones() {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) { Region.AP_SOUTHEAST_1)) {
Set<AvailabilityZoneInfo> allResults = Sets.newLinkedHashSet(client Set<AvailabilityZoneInfo> allResults = client.describeAvailabilityZonesInRegion(region);
.describeAvailabilityZonesInRegion(region));
assertNotNull(allResults); assertNotNull(allResults);
assert allResults.size() >= 2 : allResults.size(); assert allResults.size() >= 2 : allResults.size();
Iterator<AvailabilityZoneInfo> iterator = allResults.iterator(); Iterator<AvailabilityZoneInfo> iterator = allResults.iterator();
String id1 = iterator.next().getZone(); String id1 = iterator.next().getZone();
String id2 = iterator.next().getZone(); String id2 = iterator.next().getZone();
Set<AvailabilityZoneInfo> twoResults = Sets.newLinkedHashSet(client Set<AvailabilityZoneInfo> twoResults = client.describeAvailabilityZonesInRegion(region,
.describeAvailabilityZonesInRegion(region, availabilityZones(id1, id2))); availabilityZones(id1, id2));
assertNotNull(twoResults); assertNotNull(twoResults);
assertEquals(twoResults.size(), 2); assertEquals(twoResults.size(), 2);
iterator = twoResults.iterator(); iterator = allResults.iterator();
assertEquals(iterator.next().getZone(), id1); assertEquals(iterator.next().getZone(), id1);
assertEquals(iterator.next().getZone(), id2); assertEquals(iterator.next().getZone(), id2);
} }

View File

@ -30,7 +30,6 @@ import java.util.SortedSet;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.Constants; import org.jclouds.Constants;
import org.jclouds.aws.AWSResponseException;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2AsyncClient; import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client; import org.jclouds.aws.ec2.EC2Client;
@ -44,6 +43,7 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.predicates.RetryablePredicate; import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -71,13 +71,12 @@ public class ElasticBlockStoreClientLiveTest {
protected String endpoint; protected String endpoint;
protected String apiversion; protected String apiversion;
@BeforeClass
protected void setupCredentials() { protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity"); identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider credential = System.getProperty("test." + provider + ".credential");
+ ".credential"); endpoint = System.getProperty("test." + provider + ".endpoint");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint"); apiversion = System.getProperty("test." + provider + ".apiversion");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
} }
protected Properties setupProperties() { protected Properties setupProperties() {
@ -85,9 +84,12 @@ public class ElasticBlockStoreClientLiveTest {
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity); overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential); if (credential != null)
overrides.setProperty(provider + ".endpoint", endpoint); overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(provider + ".apiversion", apiversion); if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiversion != null)
overrides.setProperty(provider + ".apiversion", apiversion);
return overrides; return overrides;
} }
@ -95,15 +97,15 @@ public class ElasticBlockStoreClientLiveTest {
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();
Properties overrides = setupProperties(); Properties overrides = setupProperties();
context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()), context = new ComputeServiceContextFactory().createContext(provider,
overrides).getProviderSpecificContext(); ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getProviderSpecificContext();
client = context.getApi().getElasticBlockStoreServices(); client = context.getApi().getElasticBlockStoreServices();
} }
@Test @Test
void testDescribeVolumes() { void testDescribeVolumes() {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1, for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1,
Region.AP_SOUTHEAST_1)) { Region.AP_SOUTHEAST_1)) {
SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region)); SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region));
assertNotNull(allResults); assertNotNull(allResults);
if (allResults.size() >= 1) { if (allResults.size() >= 1) {
@ -136,11 +138,11 @@ public class ElasticBlockStoreClientLiveTest {
void testCreateSnapshotInRegion() { void testCreateSnapshotInRegion() {
Snapshot snapshot = client.createSnapshotInRegion(null, volumeId); Snapshot snapshot = client.createSnapshotInRegion(null, volumeId);
Predicate<Snapshot> snapshotted = new RetryablePredicate<Snapshot>(new SnapshotCompleted(client), 600, 10, Predicate<Snapshot> snapshotted = new RetryablePredicate<Snapshot>(new SnapshotCompleted(client), 600, 10,
TimeUnit.SECONDS); TimeUnit.SECONDS);
assert snapshotted.apply(snapshot); assert snapshotted.apply(snapshot);
Snapshot result = Iterables.getOnlyElement(client.describeSnapshotsInRegion(snapshot.getRegion(), Snapshot result = Iterables.getOnlyElement(client.describeSnapshotsInRegion(snapshot.getRegion(),
snapshotIds(snapshot.getId()))); snapshotIds(snapshot.getId())));
assertEquals(result.getProgress(), 100); assertEquals(result.getProgress(), 100);
this.snapshot = result; this.snapshot = result;
@ -152,7 +154,7 @@ public class ElasticBlockStoreClientLiveTest {
assertNotNull(volume); assertNotNull(volume);
Predicate<Volume> availabile = new RetryablePredicate<Volume>(new VolumeAvailable(client), 600, 10, Predicate<Volume> availabile = new RetryablePredicate<Volume>(new VolumeAvailable(client), 600, 10,
TimeUnit.SECONDS); TimeUnit.SECONDS);
assert availabile.apply(volume); assert availabile.apply(volume);
Volume result = Iterables.getOnlyElement(client.describeVolumesInRegion(snapshot.getRegion(), volume.getId())); Volume result = Iterables.getOnlyElement(client.describeVolumesInRegion(snapshot.getRegion(), volume.getId()));
@ -166,12 +168,12 @@ public class ElasticBlockStoreClientLiveTest {
@Test(dependsOnMethods = "testCreateSnapshotInRegion") @Test(dependsOnMethods = "testCreateSnapshotInRegion")
void testCreateVolumeFromSnapshotInAvailabilityZoneWithSize() { void testCreateVolumeFromSnapshotInAvailabilityZoneWithSize() {
Volume volume = client.createVolumeFromSnapshotInAvailabilityZone(AvailabilityZone.US_EAST_1B, 2, snapshot Volume volume = client.createVolumeFromSnapshotInAvailabilityZone(AvailabilityZone.US_EAST_1B, 2,
.getId()); snapshot.getId());
assertNotNull(volume); assertNotNull(volume);
Predicate<Volume> availabile = new RetryablePredicate<Volume>(new VolumeAvailable(client), 600, 10, Predicate<Volume> availabile = new RetryablePredicate<Volume>(new VolumeAvailable(client), 600, 10,
TimeUnit.SECONDS); TimeUnit.SECONDS);
assert availabile.apply(volume); assert availabile.apply(volume);
Volume result = Iterables.getOnlyElement(client.describeVolumesInRegion(snapshot.getRegion(), volume.getId())); Volume result = Iterables.getOnlyElement(client.describeVolumesInRegion(snapshot.getRegion(), volume.getId()));
@ -197,13 +199,13 @@ public class ElasticBlockStoreClientLiveTest {
@Test @Test
void testDescribeSnapshots() { void testDescribeSnapshots() {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1, for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1,
Region.AP_SOUTHEAST_1)) { Region.AP_SOUTHEAST_1)) {
SortedSet<Snapshot> allResults = Sets.newTreeSet(client.describeSnapshotsInRegion(region)); SortedSet<Snapshot> allResults = Sets.newTreeSet(client.describeSnapshotsInRegion(region));
assertNotNull(allResults); assertNotNull(allResults);
if (allResults.size() >= 1) { if (allResults.size() >= 1) {
Snapshot snapshot = allResults.last(); Snapshot snapshot = allResults.last();
Snapshot result = Iterables.getOnlyElement(client.describeSnapshotsInRegion(region, snapshotIds(snapshot Snapshot result = Iterables.getOnlyElement(client.describeSnapshotsInRegion(region,
.getId()))); snapshotIds(snapshot.getId())));
assertNotNull(result); assertNotNull(result);
assertEquals(result, snapshot); assertEquals(result, snapshot);
} }
@ -246,12 +248,7 @@ public class ElasticBlockStoreClientLiveTest {
@Test(dependsOnMethods = "testGetCreateVolumePermissionForSnapshot") @Test(dependsOnMethods = "testGetCreateVolumePermissionForSnapshot")
void testDeleteSnapshotInRegion() { void testDeleteSnapshotInRegion() {
client.deleteSnapshotInRegion(snapshot.getRegion(), snapshot.getId()); client.deleteSnapshotInRegion(snapshot.getRegion(), snapshot.getId());
try { assert client.describeSnapshotsInRegion(snapshot.getRegion(), snapshotIds(snapshot.getId())).size() == 0;
client.describeSnapshotsInRegion(snapshot.getRegion(), snapshotIds(snapshot.getId()));
assert false : "shoud have exception";
} catch (AWSResponseException e) {
assertEquals(e.getError().getCode(), "InvalidSnapshot.NotFound");
}
} }
@AfterTest @AfterTest

View File

@ -56,7 +56,9 @@ import org.jclouds.compute.domain.Template;
import org.jclouds.compute.predicates.NodePredicates; import org.jclouds.compute.predicates.NodePredicates;
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.ssh.jsch.config.JschSshClientModule;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -85,13 +87,12 @@ public class PlacementGroupClientLiveTest {
protected String endpoint; protected String endpoint;
protected String apiversion; protected String apiversion;
@BeforeClass
protected void setupCredentials() { protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity"); identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider credential = System.getProperty("test." + provider + ".credential");
+ ".credential"); endpoint = System.getProperty("test." + provider + ".endpoint");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint"); apiversion = System.getProperty("test." + provider + ".apiversion");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
} }
protected Properties setupProperties() { protected Properties setupProperties() {
@ -99,9 +100,12 @@ public class PlacementGroupClientLiveTest {
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity); overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential); if (credential != null)
overrides.setProperty(provider + ".endpoint", endpoint); overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(provider + ".apiversion", apiversion); if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiversion != null)
overrides.setProperty(provider + ".apiversion", apiversion);
return overrides; return overrides;
} }
@ -109,14 +113,14 @@ public class PlacementGroupClientLiveTest {
public void setupClient() throws FileNotFoundException, IOException { public void setupClient() throws FileNotFoundException, IOException {
setupCredentials(); setupCredentials();
Properties overrides = setupProperties(); Properties overrides = setupProperties();
context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet context = new ComputeServiceContextFactory().createContext(provider,
.<Module> of(new Log4JLoggingModule()), overrides); ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides);
keyPair = setupKeyPair(); keyPair = setupKeyPair();
client = EC2Client.class.cast(context.getProviderSpecificContext().getApi()); client = EC2Client.class.cast(context.getProviderSpecificContext().getApi());
availableTester = new RetryablePredicate<PlacementGroup>(new PlacementGroupAvailable(client), 60, 1, availableTester = new RetryablePredicate<PlacementGroup>(new PlacementGroupAvailable(client), 60, 1,
TimeUnit.SECONDS); TimeUnit.SECONDS);
deletedTester = new RetryablePredicate<PlacementGroup>(new PlacementGroupDeleted(client), 60, 1, TimeUnit.SECONDS); deletedTester = new RetryablePredicate<PlacementGroup>(new PlacementGroupDeleted(client), 60, 1, TimeUnit.SECONDS);
} }
@ -125,12 +129,12 @@ public class PlacementGroupClientLiveTest {
void testDescribe() { void testDescribe() {
for (String region : newArrayList(Region.US_EAST_1)) { for (String region : newArrayList(Region.US_EAST_1)) {
SortedSet<PlacementGroup> allResults = newTreeSet(client.getPlacementGroupServices() SortedSet<PlacementGroup> allResults = newTreeSet(client.getPlacementGroupServices()
.describePlacementGroupsInRegion(region)); .describePlacementGroupsInRegion(region));
assertNotNull(allResults); assertNotNull(allResults);
if (allResults.size() >= 1) { if (allResults.size() >= 1) {
PlacementGroup group = allResults.last(); PlacementGroup group = allResults.last();
SortedSet<PlacementGroup> result = newTreeSet(client.getPlacementGroupServices() SortedSet<PlacementGroup> result = newTreeSet(client.getPlacementGroupServices()
.describePlacementGroupsInRegion(region, group.getName())); .describePlacementGroupsInRegion(region, group.getName()));
assertNotNull(result); assertNotNull(result);
PlacementGroup compare = result.last(); PlacementGroup compare = result.last();
assertEquals(compare, group); assertEquals(compare, group);
@ -159,7 +163,7 @@ public class PlacementGroupClientLiveTest {
private void verifyPlacementGroup(String groupName) { private void verifyPlacementGroup(String groupName) {
assert availableTester.apply(new PlacementGroup(Region.US_EAST_1, groupName, "cluster", State.PENDING)) : group; assert availableTester.apply(new PlacementGroup(Region.US_EAST_1, groupName, "cluster", State.PENDING)) : group;
Set<PlacementGroup> oneResult = client.getPlacementGroupServices().describePlacementGroupsInRegion(null, Set<PlacementGroup> oneResult = client.getPlacementGroupServices().describePlacementGroupsInRegion(null,
groupName); groupName);
assertNotNull(oneResult); assertNotNull(oneResult);
assertEquals(oneResult.size(), 1); assertEquals(oneResult.size(), 1);
group = oneResult.iterator().next(); group = oneResult.iterator().next();
@ -169,6 +173,7 @@ public class PlacementGroupClientLiveTest {
} }
public void testStartCCInstance() throws Exception { public void testStartCCInstance() throws Exception {
Set<? extends Hardware> sizes = context.getComputeService().listHardwareProfiles(); Set<? extends Hardware> sizes = context.getComputeService().listHardwareProfiles();
assert any(sizes, new Predicate<Hardware>() { assert any(sizes, new Predicate<Hardware>() {
@ -194,17 +199,19 @@ public class PlacementGroupClientLiveTest {
assertEquals(template.getImage().getId(), "us-east-1/ami-7ea24a17"); assertEquals(template.getImage().getId(), "us-east-1/ami-7ea24a17");
template.getOptions().installPrivateKey(keyPair.get("private")).authorizePublicKey(keyPair.get("public")) template.getOptions().installPrivateKey(keyPair.get("private")).authorizePublicKey(keyPair.get("public"))
.runScript(buildScript(template.getImage().getOperatingSystem())); .runScript(buildScript(template.getImage().getOperatingSystem()));
String tag = PREFIX + "cccluster"; String tag = PREFIX + "cccluster";
context.getComputeService().destroyNodesMatching(NodePredicates.withTag(tag)); context.getComputeService().destroyNodesMatching(NodePredicates.withTag(tag));
// TODO make this not lookup an explicit region
client.getPlacementGroupServices().deletePlacementGroupInRegion(null, "jclouds#" + tag + "#us-east-1");
try { try {
Set<? extends NodeMetadata> nodes = context.getComputeService().runNodesWithTag(tag, 1, template); Set<? extends NodeMetadata> nodes = context.getComputeService().runNodesWithTag(tag, 1, template);
NodeMetadata node = getOnlyElement(nodes); NodeMetadata node = getOnlyElement(nodes);
getOnlyElement(getOnlyElement(client.getInstanceServices().describeInstancesInRegion(null, getOnlyElement(getOnlyElement(client.getInstanceServices().describeInstancesInRegion(null,
node.getProviderId()))); node.getProviderId())));
} catch (RunNodesException e) { } catch (RunNodesException e) {
System.err.println(e.getNodeErrors().keySet()); System.err.println(e.getNodeErrors().keySet());

View File

@ -162,12 +162,10 @@
<priority value="DEBUG" /> <priority value="DEBUG" />
<appender-ref ref="ASYNCSSH" /> <appender-ref ref="ASYNCSSH" />
</category> </category>
<!--
<category name="jclouds.wire"> <category name="jclouds.wire">
<priority value="DEBUG" /> <priority value="DEBUG" />
<appender-ref ref="ASYNCWIRE" /> <appender-ref ref="ASYNCWIRE" />
</category> </category>
-->
<category name="jclouds.blobstore"> <category name="jclouds.blobstore">
<priority value="DEBUG" /> <priority value="DEBUG" />
<appender-ref ref="ASYNCBLOBSTORE" /> <appender-ref ref="ASYNCBLOBSTORE" />

View File

@ -162,10 +162,12 @@
<priority value="DEBUG" /> <priority value="DEBUG" />
<appender-ref ref="ASYNCSSH" /> <appender-ref ref="ASYNCSSH" />
</category> </category>
<!--
<category name="jclouds.wire"> <category name="jclouds.wire">
<priority value="DEBUG" /> <priority value="DEBUG" />
<appender-ref ref="ASYNCWIRE" /> <appender-ref ref="ASYNCWIRE" />
</category> </category>
-->
<category name="jclouds.blobstore"> <category name="jclouds.blobstore">
<priority value="DEBUG" /> <priority value="DEBUG" />
<appender-ref ref="ASYNCBLOBSTORE" /> <appender-ref ref="ASYNCBLOBSTORE" />

View File

@ -62,6 +62,29 @@ public class SlicehostComputeServiceLiveTest extends BaseComputeServiceLiveTest
public void testAssignability() throws Exception { public void testAssignability() throws Exception {
@SuppressWarnings("unused") @SuppressWarnings("unused")
RestContext<SlicehostClient, SlicehostAsyncClient> tmContext = new ComputeServiceContextFactory().createContext( RestContext<SlicehostClient, SlicehostAsyncClient> tmContext = new ComputeServiceContextFactory().createContext(
provider, identity, credential).getProviderSpecificContext(); provider, identity, credential).getProviderSpecificContext();
}
@Test(expectedExceptions = UnsupportedOperationException.class)
public void testSuspendResume() throws Exception {
super.testSuspendResume();
}
@Test(enabled = true, dependsOnMethods = "testSuspendResume")
@Override
public void testGetNodesWithDetails() throws Exception {
super.testGetNodesWithDetails();
}
@Test(enabled = true, dependsOnMethods = "testSuspendResume")
@Override
public void testListNodes() throws Exception {
super.testListNodes();
}
@Test(enabled = true, dependsOnMethods = { "testListNodes", "testGetNodesWithDetails" })
@Override
public void testDestroyNodes() {
super.testDestroyNodes();
} }
} }

View File

@ -71,4 +71,15 @@ public class VCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
} }
} }
@Test(enabled = true, dependsOnMethods = "testSuspendResume")
@Override
public void testGetNodesWithDetails() throws Exception {
super.testGetNodesWithDetails();
}
@Test(enabled = true, dependsOnMethods = { "testListNodes", "testGetNodesWithDetails" })
@Override
public void testDestroyNodes() {
super.testDestroyNodes();
}
} }