From a38c405427cbd78a4db4cdc5cde76b023a344ef9 Mon Sep 17 00:00:00 2001 From: fazil Date: Fri, 23 Jun 2023 08:09:04 +0530 Subject: [PATCH] Add support for elasticsearch 8 --- .../elasticsearch/ElasticsearchVersion.java | 1 + .../VersionSpecificTemplates.java | 3 +- .../integration/ITElasticsearchStorageV8.java | 39 +++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 zipkin-storage/elasticsearch/src/test/java/zipkin2/elasticsearch/integration/ITElasticsearchStorageV8.java diff --git a/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/ElasticsearchVersion.java b/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/ElasticsearchVersion.java index bdbcce0c163..19fb819e47a 100644 --- a/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/ElasticsearchVersion.java +++ b/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/ElasticsearchVersion.java @@ -33,6 +33,7 @@ public final class ElasticsearchVersion implements Comparable= 0) { + if (version.compareTo(V5_0) < 0 || version.compareTo(V9_0) >= 0) { throw new IllegalArgumentException( "Elasticsearch versions 5-7.x are supported, was: " + version); } diff --git a/zipkin-storage/elasticsearch/src/test/java/zipkin2/elasticsearch/integration/ITElasticsearchStorageV8.java b/zipkin-storage/elasticsearch/src/test/java/zipkin2/elasticsearch/integration/ITElasticsearchStorageV8.java new file mode 100644 index 00000000000..d430e9ea704 --- /dev/null +++ b/zipkin-storage/elasticsearch/src/test/java/zipkin2/elasticsearch/integration/ITElasticsearchStorageV8.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015-2020 The OpenZipkin Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package zipkin2.elasticsearch.integration; + +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.TestInfo; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.RegisterExtension; +import zipkin2.elasticsearch.ElasticsearchStorage; + +import static zipkin2.elasticsearch.integration.ElasticsearchExtension.index; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +class ITElasticsearchStorageV8 extends ITElasticsearchStorage { + + @RegisterExtension ElasticsearchExtension elasticsearch = new ElasticsearchExtension(8); + + @Override ElasticsearchExtension elasticsearch() { + return elasticsearch; + } + + @Nested + class ITEnsureIndexTemplate extends zipkin2.elasticsearch.integration.ITEnsureIndexTemplate { + @Override protected ElasticsearchStorage.Builder newStorageBuilder(TestInfo testInfo) { + return elasticsearch().computeStorageBuilder().index(index(testInfo)); + } + } +}