Issue 934: make sure we fail when tags don't work

This commit is contained in:
Adrian Cole 2012-05-18 15:58:41 -07:00
parent 8fee07b1b7
commit c9096ba460
1 changed files with 7 additions and 1 deletions

View File

@ -642,14 +642,16 @@ public abstract class BaseComputeServiceLiveTest extends BaseVersionedServiceLiv
try { try {
ImmutableMap<String, String> userMetadata = ImmutableMap.<String, String> of("Name", group); ImmutableMap<String, String> userMetadata = ImmutableMap.<String, String> of("Name", group);
ImmutableSet<String> tags = ImmutableSet. of(group);
Stopwatch watch = new Stopwatch().start(); Stopwatch watch = new Stopwatch().start();
NodeMetadata node = getOnlyElement(client.createNodesInGroup(group, 1, NodeMetadata node = getOnlyElement(client.createNodesInGroup(group, 1,
inboundPorts(22, 8080).blockOnPort(22, 300).userMetadata(userMetadata))); inboundPorts(22, 8080).blockOnPort(22, 300).userMetadata(userMetadata).tags(tags)));
long createSeconds = watch.elapsedTime(TimeUnit.SECONDS); long createSeconds = watch.elapsedTime(TimeUnit.SECONDS);
final String nodeId = node.getId(); final String nodeId = node.getId();
checkUserMetadataInNodeEquals(node, userMetadata); checkUserMetadataInNodeEquals(node, userMetadata);
checkTagsInNodeEquals(node, tags);
getAnonymousLogger().info( getAnonymousLogger().info(
format("<< available node(%s) os(%s) in %ss", node.getId(), node.getOperatingSystem(), createSeconds)); format("<< available node(%s) os(%s) in %ss", node.getId(), node.getOperatingSystem(), createSeconds));
@ -758,6 +760,10 @@ public abstract class BaseComputeServiceLiveTest extends BaseVersionedServiceLiv
userMetadata, node); userMetadata, node);
} }
protected void checkTagsInNodeEquals(NodeMetadata node, ImmutableSet<String> tags) {
assert node.getTags().equals(tags) : String.format("node tags did not match %s %s", tags, node);
}
public void testListImages() throws Exception { public void testListImages() throws Exception {
for (Image image : client.listImages()) { for (Image image : client.listImages()) {
assert image.getProviderId() != null : image; assert image.getProviderId() != null : image;