ensure extra metadata from provider doesn't trip metadata tests

This commit is contained in:
Adrian Cole 2013-01-01 17:18:55 -08:00
parent e42cb787f6
commit 6e554298ab
15 changed files with 23 additions and 21 deletions

View File

@ -45,7 +45,7 @@ public class CloudSigmaComputeServiceLiveTest extends BaseComputeServiceLiveTest
// cloudsigma does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
"node userMetadata did not match %s %s", userMetadata, node);
}

View File

@ -45,7 +45,7 @@ public class CloudStackComputeServiceLiveTest extends BaseComputeServiceLiveTest
// cloudstack does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
"node userMetadata did not match %s %s", userMetadata, node);
}

View File

@ -87,7 +87,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
// normal ec2 does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
"node userMetadata did not match %s %s", userMetadata, node);
}

View File

@ -103,6 +103,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.net.HostAndPort;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
@ -647,7 +648,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
protected void createAndRunAServiceInGroup(String group) throws RunNodesException {
// note that some cloud providers do not support mixed case tag names
ImmutableMap<String, String> userMetadata = ImmutableMap.<String, String> of("name", group);
ImmutableMap<String, String> userMetadata = ImmutableMap.<String, String> of("test", group);
ImmutableSet<String> tags = ImmutableSet. of(group);
Stopwatch watch = new Stopwatch().start();
@ -657,7 +658,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
final String nodeId = node.getId();
checkUserMetadataInNodeEquals(node, userMetadata);
checkUserMetadataContains(node, userMetadata);
checkTagsInNodeEquals(node, tags);
getAnonymousLogger().info(
@ -691,9 +692,9 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
return client.runScriptOnNode(nodeId, command, runAsRoot(false).wrapInInitScript(false)).getOutput().trim();
}
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(userMetadata) : format("node userMetadata did not match %s %s",
userMetadata, node);
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
Map<String, String> missing = Maps.difference(node.getUserMetadata(), userMetadata).entriesOnlyOnRight();
assert missing.isEmpty() : format("node userMetadata did not contain %s %s", missing, node);
}
protected void checkTagsInNodeEquals(NodeMetadata node, ImmutableSet<String> tags) {

View File

@ -112,7 +112,7 @@ public abstract class AbiquoComputeServiceLiveTest extends BaseComputeServiceLiv
// Abiquo does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(final NodeMetadata node, final ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(final NodeMetadata node, final ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
"node userMetadata did not match %s %s", userMetadata, node);
}

View File

@ -55,7 +55,7 @@ public abstract class FGCPBaseComputeServiceLiveTest extends
// fgcp does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().isEmpty() : String.format(
"node userMetadata not empty: %s %s", node,
node.getUserMetadata());

View File

@ -51,7 +51,7 @@ public class VPDCComputeServiceLiveTestDisabled extends BaseComputeServiceLiveTe
// savvis does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
"node userMetadata did not match %s %s", userMetadata, node);
}

View File

@ -51,7 +51,7 @@ public class SmartOSManagerComputeServiceLiveTest extends BaseComputeServiceLive
// smartos-ssh does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
"node userMetadata did not match %s %s", userMetadata, node);
}

View File

@ -79,7 +79,7 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
// aws-ec2 supports userMetadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(userMetadata) : String.format("node userMetadata did not match %s %s",
userMetadata, node);
}
@ -102,11 +102,12 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
Date before = new Date();
ImmutableMap<String, String> userMetadata = ImmutableMap.<String, String> of("Name", group);
ImmutableMap<String, String> userMetadata = ImmutableMap.<String, String> of("test", group);
ImmutableSet<String> tags = ImmutableSet. of(group);
// note that if you change the location, you must also specify image parameters
Template template = client.templateBuilder().locationId(region).osFamily(AMZN_LINUX).os64Bit(true).build();
template.getOptions().tags(tags);
template.getOptions().userMetadata(userMetadata);
template.getOptions().as(AWSEC2TemplateOptions.class).enableMonitoring();
template.getOptions().as(AWSEC2TemplateOptions.class).spotPrice(0.3f);
@ -139,7 +140,7 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
// Name metadata should turn into node.name
assertEquals(first.getName(), group);
checkUserMetadataInNodeEquals(first, userMetadata);
checkUserMetadataContains(first, userMetadata);
checkTagsInNodeEquals(first, tags);
assert first.getCredentials() != null : first;

View File

@ -48,6 +48,6 @@ public class GleSYSComputeServiceLiveTest extends BaseComputeServiceLiveTest {
// GleSYS does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
}
}

View File

@ -60,7 +60,7 @@ public class GoGridComputeServiceLiveTest extends BaseComputeServiceLiveTest {
// gogrid does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
"node userMetadata did not match %s %s", userMetadata, node);
}

View File

@ -47,7 +47,7 @@ public class SoftLayerComputeServiceLiveTest extends BaseComputeServiceLiveTest
// softlayer does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
"node userMetadata did not match %s %s", userMetadata, node);
}

View File

@ -69,7 +69,7 @@ public class TerremarkECloudComputeServiceLiveTest extends BaseComputeServiceLiv
// terremark does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
"node userMetadata did not match %s %s", userMetadata, node);
}

View File

@ -71,7 +71,7 @@ public class TerremarkVCloudExpressComputeServiceLiveTest extends BaseComputeSer
// terremark does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
"node userMetadata did not match %s %s", userMetadata, node);
}

View File

@ -57,7 +57,7 @@ public class ServerManagerComputeServiceLiveTest extends BaseComputeServiceLiveT
// servermanager does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
"node userMetadata did not match %s %s", userMetadata, node);
}