|
31 | 31 | import org.elasticsearch.common.collect.Tuple;
|
32 | 32 | import org.elasticsearch.common.settings.Settings;
|
33 | 33 | import org.elasticsearch.plugins.Plugin;
|
| 34 | +import org.elasticsearch.rest.RestStatus; |
34 | 35 | import org.elasticsearch.test.ESIntegTestCase;
|
35 | 36 | import org.elasticsearch.test.http.MockRequest;
|
36 | 37 | import org.elasticsearch.test.http.MockResponse;
|
37 | 38 | import org.elasticsearch.test.http.MockWebServer;
|
| 39 | +import org.elasticsearch.test.junit.annotations.TestLogging; |
38 | 40 | import org.elasticsearch.xpack.core.XPackSettings;
|
| 41 | +import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkAction; |
| 42 | +import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkRequest; |
| 43 | +import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkResponse; |
39 | 44 | import org.elasticsearch.xpack.core.monitoring.action.MonitoringMigrateAlertsAction;
|
40 | 45 | import org.elasticsearch.xpack.core.monitoring.action.MonitoringMigrateAlertsRequest;
|
41 | 46 | import org.elasticsearch.xpack.core.monitoring.action.MonitoringMigrateAlertsResponse;
|
|
49 | 54 | import org.elasticsearch.xpack.monitoring.exporter.ClusterAlertsUtil;
|
50 | 55 | import org.elasticsearch.xpack.monitoring.exporter.http.HttpExporter;
|
51 | 56 | import org.elasticsearch.xpack.monitoring.exporter.local.LocalExporter;
|
| 57 | +import org.elasticsearch.xpack.monitoring.exporter.local.LocalExporterIntegTests; |
52 | 58 | import org.elasticsearch.xpack.monitoring.test.MonitoringIntegTestCase;
|
53 | 59 | import org.junit.After;
|
54 | 60 | import org.junit.Before;
|
@@ -124,7 +130,9 @@ private void stopMonitoring() {
|
124 | 130 | ));
|
125 | 131 | }
|
126 | 132 |
|
127 |
| - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/66586") |
| 133 | + @TestLogging( |
| 134 | + value = "org.elasticsearch.xpack.monitoring.exporter.local:trace", |
| 135 | + reason = "to ensure we log local exporter on trace level") |
128 | 136 | public void testLocalAlertsRemoval() throws Exception {
|
129 | 137 | try {
|
130 | 138 | // start monitoring service
|
@@ -159,6 +167,9 @@ public void testLocalAlertsRemoval() throws Exception {
|
159 | 167 | }
|
160 | 168 | }
|
161 | 169 |
|
| 170 | + @TestLogging( |
| 171 | + value = "org.elasticsearch.xpack.monitoring.exporter.local:trace", |
| 172 | + reason = "to ensure we log local exporter on trace level") |
162 | 173 | public void testRepeatedLocalAlertsRemoval() throws Exception {
|
163 | 174 | try {
|
164 | 175 | // start monitoring service
|
@@ -474,6 +485,18 @@ public void testRemoteAlertsRemoteDisallowsWatcher() throws Exception {
|
474 | 485 | }
|
475 | 486 |
|
476 | 487 | private void ensureInitialLocalResources() throws Exception {
|
| 488 | + // Should trigger setting up alert watches via LocalExporter#openBulk(...) and |
| 489 | + // then eventually to LocalExporter#setupIfElectedMaster(...) |
| 490 | + // Sometimes this last method doesn't install watches, because elected master node doesn't export monitor documents. |
| 491 | + // and then these assertions here fail. |
| 492 | + { |
| 493 | + MonitoringBulkRequest request = new MonitoringBulkRequest(); |
| 494 | + request.add(LocalExporterIntegTests.createMonitoringBulkDoc()); |
| 495 | + String masterNode = internalCluster().getMasterName(); |
| 496 | + MonitoringBulkResponse response = client(masterNode).execute(MonitoringBulkAction.INSTANCE, request).actionGet(); |
| 497 | + assertThat(response.status(), equalTo(RestStatus.OK)); |
| 498 | + } |
| 499 | + |
477 | 500 | waitForWatcherIndices();
|
478 | 501 | assertBusy(() -> {
|
479 | 502 | assertThat(indexExists(".monitoring-*"), is(true));
|
|
0 commit comments