JCLOUDS-573: Make sure to destroy all nodes created in the tests

This commit is contained in:
Ignasi Barrera 2014-05-20 13:00:11 +02:00
parent 11b778bbb9
commit 22a6028336
1 changed files with 5 additions and 1 deletions

View File

@ -18,6 +18,7 @@ package org.jclouds.compute.internal;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.and;
import static com.google.common.base.Predicates.in;
import static com.google.common.base.Predicates.not;
import static com.google.common.collect.ImmutableSet.copyOf;
import static com.google.common.collect.Iterables.concat;
@ -887,7 +888,10 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
protected void tearDownContext() {
try {
if (nodes != null) {
client.destroyNodesMatching(inGroup(group));
// Destroy all nodes in the group but also make sure to destroy other created nodes that might not be in it.
// The "testCreateTwoNodesWithOneSpecifiedName" creates nodes with an explicit name that puts them outside the group,
// so the list of nodes should also be taken into account when destroying the nodes.
client.destroyNodesMatching(Predicates.<NodeMetadata> or(inGroup(group), in(nodes)));
}
} catch (Exception e) {