From a3ff408bc4bdbd3819e89102dabe7800430810f1 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Mon, 15 Mar 2021 11:41:18 +0100 Subject: [PATCH] [Transform] fix itermittent problem in TransformIndexerTests/TransformIndexerFailureHandlingTests (#70326) fix a race condition in the test: the indexer thread might still be in the process of shutting down, when the test thread triggers it again. relates #69551 fixes #70297 --- .../transforms/TransformIndexerFailureHandlingTests.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/TransformIndexerFailureHandlingTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/TransformIndexerFailureHandlingTests.java index b7833b8e2b8b..59d4254ee260 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/TransformIndexerFailureHandlingTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/TransformIndexerFailureHandlingTests.java @@ -341,10 +341,11 @@ public void testPageSizeAdapt() throws Exception { // run indexer a 2nd time final CountDownLatch secondRunLatch = indexer.newLatch(1); - indexer.start(); assertEquals(pageSizeAfterFirstReduction, indexer.getPageSize()); assertThat(indexer.getState(), equalTo(IndexerState.STARTED)); - assertTrue(indexer.maybeTriggerAsyncJob(System.currentTimeMillis())); + + // when the indexer thread shuts down, it ignores the trigger, we might have to call it again + assertBusy(() -> assertTrue(indexer.maybeTriggerAsyncJob(System.currentTimeMillis()))); assertThat(indexer.getState(), equalTo(IndexerState.INDEXING)); secondRunLatch.countDown();