mirror of https://github.com/apache/jclouds.git
Isolate the task cancellation in a test
This commit is contained in:
parent
42079e1392
commit
87154bf89e
|
@ -27,7 +27,6 @@ import static org.testng.Assert.assertEquals;
|
|||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.easymock.IArgumentMatcher;
|
||||
|
@ -452,10 +451,10 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
|
|||
public void testAScriptExecutionAfterBootWithBasicTemplate() throws Exception {
|
||||
super.testAScriptExecutionAfterBootWithBasicTemplate();
|
||||
}
|
||||
|
||||
|
||||
@Test(enabled = false)
|
||||
@Override
|
||||
public void weCanCancelTasks(NodeMetadata node) throws InterruptedException, ExecutionException {
|
||||
public void testWeCanCancelTasks() throws Exception {
|
||||
// not sure how to do multithreading in a mock so that tests can work
|
||||
}
|
||||
|
||||
|
|
|
@ -251,7 +251,6 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
|
|||
.adminUsername("foo").adminHome("/over/ridden/foo").build(), nameTask("adminUpdate"));
|
||||
|
||||
response = future.get(3, TimeUnit.MINUTES);
|
||||
|
||||
assert response.getExitStatus() == 0 : node.getId() + ": " + response;
|
||||
|
||||
node = client.getNodeMetadata(node.getId());
|
||||
|
@ -259,18 +258,31 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
|
|||
assertEquals(node.getCredentials().identity, "foo");
|
||||
assert node.getCredentials().credential != null : nodes;
|
||||
|
||||
weCanCancelTasks(node);
|
||||
|
||||
assert response.getExitStatus() == 0 : node.getId() + ": " + response;
|
||||
|
||||
response = client.runScriptOnNode(node.getId(), "echo $USER", wrapInInitScript(false).runAsRoot(false));
|
||||
|
||||
assert response.getOutput().trim().equals("foo") : node.getId() + ": " + response;
|
||||
|
||||
} finally {
|
||||
client.destroyNodesMatching(inGroup(group));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWeCanCancelTasks() throws Exception {
|
||||
String group = this.group + "w";
|
||||
try {
|
||||
client.destroyNodesMatching(inGroup(group));
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
template = buildTemplate(client.templateBuilder());
|
||||
try {
|
||||
Set<? extends NodeMetadata> nodes = client.createNodesInGroup(group, 1, template);
|
||||
NodeMetadata node = getOnlyElement(nodes);
|
||||
weCanCancelTasks(node);
|
||||
} finally {
|
||||
client.destroyNodesMatching(inGroup(group));
|
||||
}
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
protected void tryBadPassword(String group, Credentials good) throws AssertionError {
|
||||
|
@ -806,6 +818,8 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
|
|||
provider2 = location.getParent().getParent();
|
||||
assertProvider(provider2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue