From f14cff2102704b627b18a641f38000ef319e746b Mon Sep 17 00:00:00 2001 From: David Roberts Date: Wed, 9 Jan 2019 08:51:00 +0000 Subject: [PATCH] [TEST] Ensure interrupted flag reset after test that sets it (#37230) Test fix to stop a problem in one test leaking into a different test and causing that other test to spuriously fail. --- .../xpack/ml/filestructurefinder/TimeoutCheckerTests.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/filestructurefinder/TimeoutCheckerTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/filestructurefinder/TimeoutCheckerTests.java index 8518096d644..ea581f66346 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/filestructurefinder/TimeoutCheckerTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/filestructurefinder/TimeoutCheckerTests.java @@ -72,6 +72,9 @@ public class TimeoutCheckerTests extends FileStructureTestCase { } finally { TimeoutChecker.watchdog.unregister(); } + } finally { + // ensure the interrupted flag is cleared to stop it making subsequent tests fail + Thread.interrupted(); } } @@ -89,6 +92,9 @@ public class TimeoutCheckerTests extends FileStructureTestCase { assertEquals("Aborting grok captures test during [should timeout] as it has taken longer than the timeout of [" + timeout + "]", e.getMessage()); }); + } finally { + // ensure the interrupted flag is cleared to stop it making subsequent tests fail + Thread.interrupted(); } } }