[Test] Change how LocalExporterTests stops

This commit changes how LocalExporterTests stops the monitoring
components: it first stops the monitoring service (but keeps the
local exporter enabled), deletes and checks if monitoring indices
are recreated, and then disables the local exporter.

Original commit: elastic/x-pack-elasticsearch@4c4809a660
This commit is contained in:
Tanguy Leroux 2017-04-10 15:10:56 +02:00
parent 454d6b3390
commit 310b85083d
1 changed files with 8 additions and 6 deletions

View File

@ -93,13 +93,9 @@ public class LocalExporterTests extends MonitoringIntegTestCase {
@After
public void stopMonitoring() throws Exception {
Settings.Builder exporterSettings = Settings.builder()
.putNull("xpack.monitoring.exporters._local.enabled")
.putNull("xpack.monitoring.exporters._local.index.name.time_format")
.putNull(MonitoringSettings.INTERVAL.getKey());
logger.debug("stopping monitoring service");
assertAcked(client().admin().cluster().prepareUpdateSettings()
.setTransientSettings(exporterSettings));
.setTransientSettings(Settings.builder().putNull(MonitoringSettings.INTERVAL.getKey())));
logger.debug("deleting monitoring indices, checking multiple times in case of in-flight bulk requests");
awaitBusy(() -> {
@ -116,6 +112,12 @@ public class LocalExporterTests extends MonitoringIntegTestCase {
}
return false;
});
logger.debug("disabling monitoring exporters");
assertAcked(client().admin().cluster().prepareUpdateSettings()
.setTransientSettings(Settings.builder()
.putNull("xpack.monitoring.exporters._local.enabled")
.putNull("xpack.monitoring.exporters._local.index.name.time_format")));
}
@TestLogging("org.elasticsearch.xpack.monitoring:TRACE")