diff --git a/full-backend-tests/src/test/java/org/graylog2/indexer/indices/IndicesIT.java b/full-backend-tests/src/test/java/org/graylog2/indexer/indices/IndicesIT.java index 6c87b6399d95a..e14480ad5ad66 100644 --- a/full-backend-tests/src/test/java/org/graylog2/indexer/indices/IndicesIT.java +++ b/full-backend-tests/src/test/java/org/graylog2/indexer/indices/IndicesIT.java @@ -87,7 +87,7 @@ public class IndicesIT extends ContainerMatrixElasticsearchBaseTest { .id("index-set-1") .title("Index set 1") .description("For testing") - .indexPrefix("graylog") + .indexPrefix("test_index_set") .creationDate(ZonedDateTime.now()) .shards(1) .replicas(0) @@ -103,7 +103,6 @@ public class IndicesIT extends ContainerMatrixElasticsearchBaseTest { protected static final IndexSet indexSet = new TestIndexSet(indexSetConfig); private final Set indicesToCleanUp = new HashSet<>(); protected Indices indices; - @SuppressWarnings("UnstableApiUsage") private EventBus eventBus; private final NodeId nodeId = new SimpleNodeId("5ca1ab1e-0000-4000-a000-000000000000"); @@ -121,7 +120,6 @@ protected Map createTemplateFor(String indexWildcard, Map { - indices.indexRangeStatsOfIndex("does-not-exist"); - }); + assertThrows(IndexNotFoundException.class, () -> indices.indexRangeStatsOfIndex("does-not-exist")); } @ContainerMatrixTest @@ -306,7 +302,7 @@ public void createOverwritesIndexTemplate() { "properties", ImmutableMap.of("message", ImmutableMap.of("type", "text"))); - var templateSource = Template.create(indexSet.getIndexWildcard(), new Template.Mappings(beforeMapping), 0L, new Template.Settings(Map.of())); + var templateSource = Template.create(indexSet.getIndexWildcard(), new Template.Mappings(beforeMapping), 1L, new Template.Settings(Map.of())); client().putTemplate(templateName, templateSource); @@ -409,7 +405,7 @@ public void ensureIndexTemplateThrowsOnIgnoreIndexTemplateAndNonExistingTemplate try { indices.deleteIndexTemplate(indexSet); - } catch (Exception e) { + } catch (Exception ignored) { } assertThat(client().templateExists(templateName)).isFalse(); @@ -651,7 +647,6 @@ public void cyclingAliasLeavesOldIndexInPlace() { assertThat(indices.exists(index1)).isTrue(); } - @SuppressWarnings("UnstableApiUsage") public static final class IndicesEventListener { final List indicesClosedEvents = Collections.synchronizedList(new ArrayList<>()); final List indicesDeletedEvents = Collections.synchronizedList(new ArrayList<>()); diff --git a/graylog-storage-opensearch2/src/test/java/org/graylog/storage/opensearch2/testing/ClientOS2.java b/graylog-storage-opensearch2/src/test/java/org/graylog/storage/opensearch2/testing/ClientOS2.java index 806c5b78f2cca..af85505382de1 100644 --- a/graylog-storage-opensearch2/src/test/java/org/graylog/storage/opensearch2/testing/ClientOS2.java +++ b/graylog-storage-opensearch2/src/test/java/org/graylog/storage/opensearch2/testing/ClientOS2.java @@ -40,8 +40,6 @@ import org.graylog.shaded.opensearch2.org.opensearch.client.indices.DeleteComposableIndexTemplateRequest; import org.graylog.shaded.opensearch2.org.opensearch.client.indices.GetComposableIndexTemplateRequest; import org.graylog.shaded.opensearch2.org.opensearch.client.indices.GetIndexRequest; -import org.graylog.shaded.opensearch2.org.opensearch.client.indices.GetIndexTemplatesRequest; -import org.graylog.shaded.opensearch2.org.opensearch.client.indices.GetIndexTemplatesResponse; import org.graylog.shaded.opensearch2.org.opensearch.client.indices.GetMappingsRequest; import org.graylog.shaded.opensearch2.org.opensearch.client.indices.GetMappingsResponse; import org.graylog.shaded.opensearch2.org.opensearch.client.indices.PutComposableIndexTemplateRequest; @@ -164,11 +162,12 @@ private Stream> extractFieldMappings(String index, J @Override public boolean templateExists(String templateName) { - final GetIndexTemplatesRequest request = new GetIndexTemplatesRequest("*"); - final GetIndexTemplatesResponse result = client.execute((c, requestOptions) -> c.indices().getIndexTemplate(request, requestOptions)); + var request = new GetComposableIndexTemplateRequest(""); + var result = client.execute((c, requestOptions) -> c.indices().getIndexTemplate(request, requestOptions)); return result.getIndexTemplates() + .keySet() .stream() - .anyMatch(indexTemplate -> indexTemplate.name().equals(templateName)); + .anyMatch(indexTemplate -> indexTemplate.equals(templateName)); } @Override diff --git a/graylog2-server/src/test/java/org/graylog/testing/elasticsearch/ContainerMatrixElasticsearchBaseTest.java b/graylog2-server/src/test/java/org/graylog/testing/elasticsearch/ContainerMatrixElasticsearchBaseTest.java index 05cc68c2aa50a..d309d4ab05bb1 100644 --- a/graylog2-server/src/test/java/org/graylog/testing/elasticsearch/ContainerMatrixElasticsearchBaseTest.java +++ b/graylog2-server/src/test/java/org/graylog/testing/elasticsearch/ContainerMatrixElasticsearchBaseTest.java @@ -59,7 +59,7 @@ private void addGraylogDefaultIndexTemplate() { private static Map getGraylogDefaultMessageTemplates(SearchVersion version) { var template = new MessageIndexTemplateProvider().create(version, null) - .messageTemplate("*", "standard", 1L); + .messageTemplate("*", "standard", 100L); return Collections.singletonMap("graylog-test-internal", template); } diff --git a/graylog2-server/src/test/java/org/graylog/testing/elasticsearch/ElasticsearchBaseTest.java b/graylog2-server/src/test/java/org/graylog/testing/elasticsearch/ElasticsearchBaseTest.java index ea5ad7776ca31..655a8b211e455 100644 --- a/graylog2-server/src/test/java/org/graylog/testing/elasticsearch/ElasticsearchBaseTest.java +++ b/graylog2-server/src/test/java/org/graylog/testing/elasticsearch/ElasticsearchBaseTest.java @@ -53,7 +53,7 @@ private void addGraylogDefaultIndexTemplate() { private static Map getGraylogDefaultMessageTemplates(SearchVersion version) { var template = new MessageIndexTemplateProvider().create(version, null) - .messageTemplate("*", "standard", 0L); + .messageTemplate("*", "standard", 100L); return Collections.singletonMap("graylog-test-internal", template); }