@Test(enabled = true, dependsOnMethods = "testCreateTwoNodesWithRunScript")
public void testCreateAnotherNodeWithANewContextToEnsureSharedMemIsntRequired() throws Exception {
initializeContext();
Location existingLocation = Iterables.get(this.nodes, 0).getLocation();
boolean existingLocationIsAssignable = Iterables.any(client.listAssignableLocations(),
Predicates.equalTo(existingLocation));
if (existingLocationIsAssignable) {
getAnonymousLogger().info("creating another node based on existing nodes' location: " + existingLocation);
template = addRunScriptToTemplate(client.templateBuilder().fromTemplate(template)
.locationId(existingLocation.getId()).build());
} else {
refreshTemplate();
getAnonymousLogger().info(
format("%s is not assignable; using template's location %s as ", existingLocation,
template.getLocation()));
}
Set<? extends NodeMetadata> nodes = client.createNodesInGroup(group, 1, template);
assertEquals(nodes.size(), 1);
checkNodes(nodes, group, "bootstrap");
NodeMetadata node = Iterables.getOnlyElement(nodes);
if (existingLocationIsAssignable)
assertEquals(node.getLocation(), existingLocation);
else
this.assertLocationSameOrChild(checkNotNull(node.getLocation(), "location of %s", node), template.getLocation());
checkOsMatchesTemplate(node);
this.nodes.add(node);
}