mirror of https://github.com/apache/jclouds.git
JCLOUDS-573: Make sure to destroy all nodes created in the tests
This commit is contained in:
parent
11b778bbb9
commit
22a6028336
|
@ -18,6 +18,7 @@ package org.jclouds.compute.internal;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.base.Predicates.and;
|
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.base.Predicates.not;
|
||||||
import static com.google.common.collect.ImmutableSet.copyOf;
|
import static com.google.common.collect.ImmutableSet.copyOf;
|
||||||
import static com.google.common.collect.Iterables.concat;
|
import static com.google.common.collect.Iterables.concat;
|
||||||
|
@ -887,7 +888,10 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
|
||||||
protected void tearDownContext() {
|
protected void tearDownContext() {
|
||||||
try {
|
try {
|
||||||
if (nodes != null) {
|
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) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue