aboutsummaryrefslogtreecommitdiffstats
path: root/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahoo-inc.com>2017-09-21 13:19:44 +0200
committerTor Brede Vekterli <vekterli@yahoo-inc.com>2017-09-25 16:05:23 +0200
commitdebb34547c76429e8a345299e4765824903f784c (patch)
tree34ac382d6296f63f2086032bdf37956f8caad1ff /clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java
parentd2a0cce57df4d1bcfa41ed4cbfadc705636df142 (diff)
Immediately complete failed remote tasks
We check both for master status and task failure, as we otherwise place a potentially dangerous silent dependency on the task always failing itself if the controller is not a master.
Diffstat (limited to 'clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java')
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java
index 6a8ffae8f3f..d9815241920 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java
@@ -1275,6 +1275,11 @@ public class StateChangeTest extends FleetControllerTest {
}
}
+ private static class FailingMockSynchronousTaskWithSideEffects extends MockSynchronousTaskWithSideEffects {
+ @Override
+ public boolean isFailed() { return true; }
+ }
+
private static class MockNoOpSynchronousTask extends MockTask {
@Override
public void doRemoteFleetControllerTask(Context ctx) {
@@ -1310,6 +1315,10 @@ public class StateChangeTest extends FleetControllerTest {
return scheduleTask(new MockNoOpSynchronousTask());
}
+ MockTask scheduleFailingVersionDependentTaskWithSideEffects() throws Exception {
+ return scheduleTask(new FailingMockSynchronousTaskWithSideEffects());
+ }
+
void markStorageNodeDown(int index) throws Exception {
communicator.setNodeState(new Node(NodeType.STORAGE, index), State.DOWN, "foo"); // Auto-ACKed
ctrl.tick();
@@ -1396,6 +1405,15 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
+ public void failing_task_is_immediately_completed() throws Exception {
+ RemoteTaskFixture fixture = createDefaultFixture();
+ MockTask task = fixture.scheduleFailingVersionDependentTaskWithSideEffects();
+
+ assertTrue(task.isInvoked());
+ assertTrue(task.isCompleted());
+ }
+
+ @Test
public void no_op_synchronous_remote_task_can_complete_immediately_if_current_state_already_acked() throws Exception {
RemoteTaskFixture fixture = createFixtureWith(optionsWithZeroTransitionTime());
fixture.markStorageNodeDown(0);