test: add the index audit trail template to the excluded list when it is used

Closes elastic/elasticsearch#639

Original commit: elastic/x-pack-elasticsearch@111231b3b5
This commit is contained in:
jaymode 2015-09-17 09:21:58 -04:00
parent 08698fda29
commit ba13e3bf1c
3 changed files with 22 additions and 10 deletions

View File

@ -18,6 +18,9 @@ import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.junit.Test;
import java.util.Collections;
import java.util.Set;
import static org.hamcrest.Matchers.is;
@ClusterScope(scope = Scope.TEST, randomDynamicTemplates = false)
@ -25,6 +28,11 @@ public class IndexAuditTrailEnabledTests extends ShieldIntegTestCase {
IndexNameResolver.Rollover rollover = randomFrom(IndexNameResolver.Rollover.values());
@Override
protected Set<String> excludeTemplates() {
return Collections.singleton(IndexAuditTrail.INDEX_TEMPLATE_NAME);
}
@Override
protected Settings nodeSettings(int nodeOrdinal) {
Settings.Builder builder = Settings.builder()

View File

@ -49,10 +49,7 @@ import org.junit.Test;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.*;
import static org.elasticsearch.shield.audit.index.IndexNameResolver.Rollover.DAILY;
import static org.elasticsearch.shield.audit.index.IndexNameResolver.Rollover.HOURLY;
@ -90,6 +87,11 @@ public class IndexAuditTrailTests extends ShieldIntegTestCase {
private int numReplicas;
private ThreadPool threadPool;
@Override
protected Set<String> excludeTemplates() {
return Collections.singleton(IndexAuditTrail.INDEX_TEMPLATE_NAME);
}
private Settings commonSettings(IndexNameResolver.Rollover rollover) {
return Settings.builder()
.put("shield.audit.enabled", true)
@ -212,9 +214,9 @@ public class IndexAuditTrailTests extends ShieldIntegTestCase {
auditor.close();
}
cluster().wipe(Collections.<String>emptySet());
cluster().wipe(Collections.singleton(IndexAuditTrail.INDEX_TEMPLATE_NAME));
if (remoteIndexing && cluster2 != null) {
cluster2.wipe(Collections.emptySet());
cluster2.wipe(Collections.singleton(IndexAuditTrail.INDEX_TEMPLATE_NAME));
remoteClient.close();
cluster2.close();
}

View File

@ -19,10 +19,7 @@ import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static org.elasticsearch.test.InternalTestCluster.clusterName;
@ -56,6 +53,11 @@ public class RemoteIndexAuditTrailStartingTests extends ShieldIntegTestCase {
.build();
}
@Override
protected Set<String> excludeTemplates() {
return Collections.singleton(IndexAuditTrail.INDEX_TEMPLATE_NAME);
}
@Override
public void beforeIndexDeletion() {
// For this test, this is a NO-OP because the index audit trail will continue to capture events and index after