From 480406ebc7748d9eb2e5ad2b24158dc03403035f Mon Sep 17 00:00:00 2001 From: jaymode Date: Thu, 3 Sep 2015 13:00:42 -0400 Subject: [PATCH] Test: stop the IndexAuditTrail if running to prevent locked shards The InternalTestCluster checks after the tests run if there are any locked shards, which is still possible because the IndexAuditTrail is running and auditing events. This change makes the test stop the IndexAuditTrail if they are running in the local cluster. Original commit: elastic/x-pack-elasticsearch@f7fb564525a8c3f49d4979b48babebc4f6924f0a --- .../audit/index/RemoteIndexAuditTrailStartingTests.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shield/src/test/java/org/elasticsearch/shield/audit/index/RemoteIndexAuditTrailStartingTests.java b/shield/src/test/java/org/elasticsearch/shield/audit/index/RemoteIndexAuditTrailStartingTests.java index b48744b0412..f95febbc1b3 100644 --- a/shield/src/test/java/org/elasticsearch/shield/audit/index/RemoteIndexAuditTrailStartingTests.java +++ b/shield/src/test/java/org/elasticsearch/shield/audit/index/RemoteIndexAuditTrailStartingTests.java @@ -113,6 +113,14 @@ public class RemoteIndexAuditTrailStartingTests extends ShieldIntegTestCase { } remoteCluster.close(); } + + // stop the index audit trail so that the shards aren't locked causing the test to fail + if (outputs.contains("index")) { + Iterable auditTrails = internalCluster().getInstances(IndexAuditTrail.class); + for (IndexAuditTrail auditTrail : auditTrails) { + auditTrail.close(); + } + } } @Test