Search in sources :

Example 11 with TasksService

use of io.crate.execution.jobs.TasksService in project crate by crate.

the class NodeDisconnectJobMonitorServiceTest method testOnNodeDisconnectedKillsJobOriginatingFromThatNode.

@Test
public void testOnNodeDisconnectedKillsJobOriginatingFromThatNode() throws Exception {
    TasksService tasksService = tasksInstance();
    RootTask.Builder builder = tasksService.newBuilder(UUID.randomUUID());
    builder.addTask(new DummyTask());
    RootTask context = tasksService.createTask(builder);
    NodeDisconnectJobMonitorService monitorService = new NodeDisconnectJobMonitorService(tasksService, new NodeLimits(new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS)), mock(TransportService.class), mock(TransportKillJobsNodeAction.class));
    monitorService.onNodeDisconnected(new DiscoveryNode(NODE_ID, buildNewFakeTransportAddress(), Version.CURRENT), mock(Transport.Connection.class));
    expectedException.expect(TaskMissing.class);
    tasksService.getTask(context.jobId());
    monitorService.close();
}
Also used : TransportKillJobsNodeAction(io.crate.execution.jobs.kill.TransportKillJobsNodeAction) DummyTask(io.crate.execution.jobs.DummyTask) DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) ClusterSettings(org.elasticsearch.common.settings.ClusterSettings) TransportService(org.elasticsearch.transport.TransportService) NodeLimits(io.crate.execution.jobs.NodeLimits) TasksService(io.crate.execution.jobs.TasksService) RootTask(io.crate.execution.jobs.RootTask) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest) Test(org.junit.Test)

Aggregations

TasksService (io.crate.execution.jobs.TasksService)11 Test (org.junit.Test)8 CrateDummyClusterServiceUnitTest (io.crate.test.integration.CrateDummyClusterServiceUnitTest)7 RootTask (io.crate.execution.jobs.RootTask)5 TransportKillJobsNodeAction (io.crate.execution.jobs.kill.TransportKillJobsNodeAction)5 JobsLogs (io.crate.execution.engine.collect.stats.JobsLogs)4 UUID (java.util.UUID)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)4 TransportService (org.elasticsearch.transport.TransportService)4 KillJobsRequest (io.crate.execution.jobs.kill.KillJobsRequest)3 ActionListener (org.elasticsearch.action.ActionListener)3 DummyTask (io.crate.execution.jobs.DummyTask)2 NodeLimits (io.crate.execution.jobs.NodeLimits)2 TestingRowConsumer (io.crate.testing.TestingRowConsumer)2 Field (java.lang.reflect.Field)2 Collection (java.util.Collection)2 DiscoveryNode (org.elasticsearch.cluster.node.DiscoveryNode)2 ClusterSettings (org.elasticsearch.common.settings.ClusterSettings)2 TransportShardDeleteAction (io.crate.execution.dml.delete.TransportShardDeleteAction)1 TransportShardUpsertAction (io.crate.execution.dml.upsert.TransportShardUpsertAction)1