From 259923cc39a8cdef79dc40c2c2baaacbdfcefe02 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Wed, 23 Feb 2022 01:12:16 +0900 Subject: [PATCH] Add integration tests for Elasticsearch 8 (#3037) This commit also updates the existing integration tests to use Elasticsearch 7.17.0. --- ...ctElasticsearchApiKeyIntegrationTest.java} | 7 +++-- ...ticsearchMeterRegistryIntegrationTest.java | 3 ++ .../Elasticsearch7ApiKeyIntegrationTest.java | 30 ++++++++++++++++++ .../Elasticsearch8ApiKeyIntegrationTest.java | 30 ++++++++++++++++++ ...RegistryElasticsearch7IntegrationTest.java | 2 +- ...RegistryElasticsearch8IntegrationTest.java | 31 +++++++++++++++++++ 6 files changed, 100 insertions(+), 3 deletions(-) rename implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/{ElasticsearchApiKeyIntegrationTest.java => AbstractElasticsearchApiKeyIntegrationTest.java} (90%) create mode 100644 implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/Elasticsearch7ApiKeyIntegrationTest.java create mode 100644 implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/Elasticsearch8ApiKeyIntegrationTest.java create mode 100644 implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/ElasticsearchMeterRegistryElasticsearch8IntegrationTest.java diff --git a/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/ElasticsearchApiKeyIntegrationTest.java b/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/AbstractElasticsearchApiKeyIntegrationTest.java similarity index 90% rename from implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/ElasticsearchApiKeyIntegrationTest.java rename to implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/AbstractElasticsearchApiKeyIntegrationTest.java index 5c4df82121..bd2619c04d 100644 --- a/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/ElasticsearchApiKeyIntegrationTest.java +++ b/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/AbstractElasticsearchApiKeyIntegrationTest.java @@ -24,9 +24,12 @@ import java.util.Base64; /** - * Test Elasticsearch backend with API key authentication. + * Base class for testing Elasticsearch backend with API key authentication. + * + * @author Tommy Ludwig + * @author Johnny Lim */ -class ElasticsearchApiKeyIntegrationTest extends ElasticsearchMeterRegistryElasticsearch7IntegrationTest { +abstract class AbstractElasticsearchApiKeyIntegrationTest extends AbstractElasticsearchMeterRegistryIntegrationTest { @Override protected ElasticConfig getConfig() { diff --git a/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/AbstractElasticsearchMeterRegistryIntegrationTest.java b/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/AbstractElasticsearchMeterRegistryIntegrationTest.java index c90fdea471..8fb5679b61 100644 --- a/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/AbstractElasticsearchMeterRegistryIntegrationTest.java +++ b/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/AbstractElasticsearchMeterRegistryIntegrationTest.java @@ -40,6 +40,9 @@ @Tag("docker") abstract class AbstractElasticsearchMeterRegistryIntegrationTest { + protected static final String VERSION_7 = "7.17.0"; + protected static final String VERSION_8 = "8.0.0"; + protected static final String USER = "elastic"; protected static final String PASSWORD = "changeme"; diff --git a/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/Elasticsearch7ApiKeyIntegrationTest.java b/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/Elasticsearch7ApiKeyIntegrationTest.java new file mode 100644 index 0000000000..b87f136204 --- /dev/null +++ b/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/Elasticsearch7ApiKeyIntegrationTest.java @@ -0,0 +1,30 @@ +/* + * Copyright 2022 VMware, Inc. + * + * 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 + * + * https://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 io.micrometer.elastic; + +/** + * Integration tests with API key authentication for Elasticsearch 7. + * + * @author Johnny Lim + */ +class Elasticsearch7ApiKeyIntegrationTest extends AbstractElasticsearchApiKeyIntegrationTest { + + @Override + protected String getVersion() { + return VERSION_7; + } + +} diff --git a/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/Elasticsearch8ApiKeyIntegrationTest.java b/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/Elasticsearch8ApiKeyIntegrationTest.java new file mode 100644 index 0000000000..b8e3468e8e --- /dev/null +++ b/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/Elasticsearch8ApiKeyIntegrationTest.java @@ -0,0 +1,30 @@ +/* + * Copyright 2022 VMware, Inc. + * + * 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 + * + * https://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 io.micrometer.elastic; + +/** + * Integration tests with API key authentication for Elasticsearch 8. + * + * @author Johnny Lim + */ +class Elasticsearch8ApiKeyIntegrationTest extends AbstractElasticsearchApiKeyIntegrationTest { + + @Override + protected String getVersion() { + return VERSION_8; + } + +} diff --git a/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/ElasticsearchMeterRegistryElasticsearch7IntegrationTest.java b/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/ElasticsearchMeterRegistryElasticsearch7IntegrationTest.java index 0c7e0834c4..69cbb22450 100644 --- a/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/ElasticsearchMeterRegistryElasticsearch7IntegrationTest.java +++ b/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/ElasticsearchMeterRegistryElasticsearch7IntegrationTest.java @@ -25,7 +25,7 @@ class ElasticsearchMeterRegistryElasticsearch7IntegrationTest @Override protected String getVersion() { - return "7.16.3"; + return VERSION_7; } } diff --git a/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/ElasticsearchMeterRegistryElasticsearch8IntegrationTest.java b/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/ElasticsearchMeterRegistryElasticsearch8IntegrationTest.java new file mode 100644 index 0000000000..b241f21ec9 --- /dev/null +++ b/implementations/micrometer-registry-elastic/src/test/java/io/micrometer/elastic/ElasticsearchMeterRegistryElasticsearch8IntegrationTest.java @@ -0,0 +1,31 @@ +/* + * Copyright 2022 VMware, Inc. + * + * 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 + * + * https://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 io.micrometer.elastic; + +/** + * Integration tests on {@link ElasticMeterRegistry} for Elasticsearch 8. + * + * @author Johnny Lim + */ +class ElasticsearchMeterRegistryElasticsearch8IntegrationTest + extends AbstractElasticsearchMeterRegistryIntegrationTest { + + @Override + protected String getVersion() { + return VERSION_8; + } + +}