mirror of https://github.com/apache/jclouds.git
ensure extra metadata from provider doesn't trip metadata tests
This commit is contained in:
parent
e42cb787f6
commit
6e554298ab
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue