From df86125a7de20ba44c602387d6509df48064d87c Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 23 Mar 2017 11:34:39 +0100 Subject: [PATCH] [TEST] Adjust assertions. Original commit: elastic/x-pack-elasticsearch@39b289a4d926cae8d49f8f95e7c7391e1b787778 --- .../xpack/ml/integration/BasicDistributedJobsIT.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/BasicDistributedJobsIT.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/BasicDistributedJobsIT.java index d94f1134a7a..056961f1814 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/BasicDistributedJobsIT.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/BasicDistributedJobsIT.java @@ -13,6 +13,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.test.junit.annotations.TestLogging; import org.elasticsearch.xpack.ml.MachineLearning; +import org.elasticsearch.xpack.ml.MlMetadata; import org.elasticsearch.xpack.ml.action.CloseJobAction; import org.elasticsearch.xpack.ml.action.GetDatafeedsStatsAction; import org.elasticsearch.xpack.ml.action.GetJobsStatsAction; @@ -359,14 +360,13 @@ public class BasicDistributedJobsIT extends BaseMlIntegTestCase { ClusterState clusterState = client().admin().cluster().prepareState().get().getState(); PersistentTasksCustomMetaData tasks = clusterState.getMetaData().custom(PersistentTasksCustomMetaData.TYPE); assertEquals(1, tasks.taskMap().size()); - PersistentTask task = tasks.findTasks(OpenJobAction.NAME, p -> { - return p.getRequest() instanceof OpenJobAction.Request && - jobId.equals(((OpenJobAction.Request) p.getRequest()).getJobId()); - }).iterator().next(); + PersistentTask task = MlMetadata.getJobTask(jobId, tasks); assertNotNull(task); if (hasExecutorNode) { assertNotNull(task.getExecutorNode()); + assertTrue(task.isCurrentStatus()); + assertFalse(task.needsReassignment(clusterState.nodes())); DiscoveryNode node = clusterState.nodes().resolveNode(task.getExecutorNode()); Map expectedNodeAttr = new HashMap<>(); expectedNodeAttr.put(MAX_RUNNING_JOBS_PER_NODE.getKey(), "10");