diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformRestTestCase.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformRestTestCase.java index d9c61dddeab47..2d4adae7aaa8a 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformRestTestCase.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformRestTestCase.java @@ -363,9 +363,12 @@ protected static void deleteTransform(String transformId) throws IOException { } @After - public void waitForDataFrame() throws Exception { - wipeTransforms(); - waitForPendingDataFrameTasks(); + public void waitForTransform() throws Exception { + if (preserveClusterUponCompletion() == false) { + ensureNoInitializingShards(); + wipeTransforms(); + waitForPendingTransformTasks(); + } } @AfterClass @@ -416,7 +419,7 @@ public void wipeTransforms() throws IOException { } } - protected static void waitForPendingDataFrameTasks() throws Exception { + protected static void waitForPendingTransformTasks() throws Exception { waitForPendingTasks(adminClient(), taskName -> taskName.startsWith(TransformField.TASK_NAME) == false); }