mirror of
https://github.com/apache/jclouds.git
synced 2025-02-10 12:06:14 +00:00
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.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.easymock.IArgumentMatcher;
|
import org.easymock.IArgumentMatcher;
|
||||||
@ -455,7 +454,7 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
|
|||||||
|
|
||||||
@Test(enabled = false)
|
@Test(enabled = false)
|
||||||
@Override
|
@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
|
// 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"));
|
.adminUsername("foo").adminHome("/over/ridden/foo").build(), nameTask("adminUpdate"));
|
||||||
|
|
||||||
response = future.get(3, TimeUnit.MINUTES);
|
response = future.get(3, TimeUnit.MINUTES);
|
||||||
|
|
||||||
assert response.getExitStatus() == 0 : node.getId() + ": " + response;
|
assert response.getExitStatus() == 0 : node.getId() + ": " + response;
|
||||||
|
|
||||||
node = client.getNodeMetadata(node.getId());
|
node = client.getNodeMetadata(node.getId());
|
||||||
@ -259,12 +258,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
|
|||||||
assertEquals(node.getCredentials().identity, "foo");
|
assertEquals(node.getCredentials().identity, "foo");
|
||||||
assert node.getCredentials().credential != null : nodes;
|
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));
|
response = client.runScriptOnNode(node.getId(), "echo $USER", wrapInInitScript(false).runAsRoot(false));
|
||||||
|
|
||||||
assert response.getOutput().trim().equals("foo") : node.getId() + ": " + response;
|
assert response.getOutput().trim().equals("foo") : node.getId() + ": " + response;
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
@ -272,6 +266,24 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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)
|
@Test(enabled = false)
|
||||||
protected void tryBadPassword(String group, Credentials good) throws AssertionError {
|
protected void tryBadPassword(String group, Credentials good) throws AssertionError {
|
||||||
try {
|
try {
|
||||||
@ -806,6 +818,8 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
|
|||||||
provider2 = location.getParent().getParent();
|
provider2 = location.getParent().getParent();
|
||||||
assertProvider(provider2);
|
assertProvider(provider2);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user