Skip to content

Commit 4aff06a

Browse files
committed
Polish "Upgrade to Elasticsearch 9.0.2"
CLoses gh-46052
1 parent fb43b65 commit 4aff06a

File tree

6 files changed

+12
-20
lines changed

6 files changed

+12
-20
lines changed

spring-boot-project/spring-boot-docker-compose/src/dockerTest/java/org/springframework/boot/docker/compose/service/connection/elasticsearch/ElasticsearchDockerComposeConnectionDetailsFactoryIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@
3434
*/
3535
class ElasticsearchDockerComposeConnectionDetailsFactoryIntegrationTests {
3636

37-
@DockerComposeTest(composeFile = "elasticsearch-compose.yaml", image = TestImage.ELASTICSEARCH_8)
37+
@DockerComposeTest(composeFile = "elasticsearch-compose.yaml", image = TestImage.ELASTICSEARCH)
3838
void runCreatesConnectionDetails(ElasticsearchConnectionDetails connectionDetails) {
3939
assertConnectionDetails(connectionDetails);
4040
}

spring-boot-project/spring-boot-testcontainers/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dependencies {
2828
}
2929
dockerTestImplementation("org.assertj:assertj-core")
3030
dockerTestImplementation("org.awaitility:awaitility")
31+
dockerTestImplementation("org.elasticsearch.client:elasticsearch-rest-client")
3132
dockerTestImplementation("org.flywaydb:flyway-core")
3233
dockerTestImplementation("org.junit.jupiter:junit-jupiter")
3334
dockerTestImplementation("org.junit.platform:junit-platform-launcher")

spring-boot-project/spring-boot-testcontainers/src/dockerTest/java/org/springframework/boot/testcontainers/service/connection/elasticsearch/ElasticsearchContainerConnectionDetailsFactoryTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchConnectionDetails;
3232
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration;
3333
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
34-
import org.springframework.boot.testsupport.container.ElasticsearchContainer8;
34+
import org.springframework.boot.testsupport.container.ElasticsearchContainer9;
3535
import org.springframework.context.annotation.Configuration;
3636
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
3737

@@ -48,7 +48,7 @@ class ElasticsearchContainerConnectionDetailsFactoryTests {
4848

4949
@Container
5050
@ServiceConnection
51-
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer8().withStartupAttempts(5)
51+
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer9().withStartupAttempts(5)
5252
.withStartupTimeout(Duration.ofMinutes(10));
5353

5454
@Autowired(required = false)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
*
2424
* @author Dmytro Nosan
2525
*/
26-
public class ElasticsearchContainer8 extends ElasticsearchContainer {
26+
public class ElasticsearchContainer9 extends ElasticsearchContainer {
2727

28-
public ElasticsearchContainer8() {
29-
super(TestImage.ELASTICSEARCH_8.toString());
28+
public ElasticsearchContainer9() {
29+
super(TestImage.ELASTICSEARCH.toString());
3030
addEnv("ES_JAVA_OPTS", "-Xms32m -Xmx512m");
3131
addEnv("xpack.security.enabled", "false");
3232
}

spring-boot-project/spring-boot-tools/spring-boot-test-support-docker/src/main/java/org/springframework/boot/testsupport/container/TestImage.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import org.testcontainers.containers.PulsarContainer;
3737
import org.testcontainers.containers.RabbitMQContainer;
3838
import org.testcontainers.couchbase.CouchbaseContainer;
39-
import org.testcontainers.elasticsearch.ElasticsearchContainer;
4039
import org.testcontainers.grafana.LgtmStackContainer;
4140
import org.testcontainers.kafka.ConfluentKafkaContainer;
4241
import org.testcontainers.ldap.LLdapContainer;
@@ -108,17 +107,9 @@ public enum TestImage {
108107
.withStartupTimeout(Duration.ofMinutes(10))),
109108

110109
/**
111-
* A container image suitable for testing Elasticsearch 7.
110+
* A container image suitable for testing Elasticsearch.
112111
*/
113-
ELASTICSEARCH("docker.elastic.co/elasticsearch/elasticsearch", "7.17.28", () -> ElasticsearchContainer.class,
114-
(container) -> ((ElasticsearchContainer) container).withEnv("ES_JAVA_OPTS", "-Xms32m -Xmx512m")
115-
.withStartupAttempts(5)
116-
.withStartupTimeout(Duration.ofMinutes(10))),
117-
118-
/**
119-
* A container image suitable for testing Elasticsearch 8.
120-
*/
121-
ELASTICSEARCH_8("elasticsearch", "8.17.1"),
112+
ELASTICSEARCH("elasticsearch", "9.0.2"),
122113

123114
/**
124115
* A container image suitable for testing Grafana OTel LGTM.
@@ -279,7 +270,7 @@ public enum TestImage {
279270
/**
280271
* A container image suitable for testing Elasticsearch via Bitnami.
281272
*/
282-
BITNAMI_ELASTICSEARCH("bitnami/elasticsearch", "8.12.1"),
273+
BITNAMI_ELASTICSEARCH("bitnami/elasticsearch", "9.0.2"),
283274

284275
/**
285276
* A container image suitable for testing MariaDB via Bitnami.

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearch8ApplicationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class SampleElasticsearch8ApplicationTests {
4444
@Container
4545
@ServiceConnection
4646
@Ssl
47-
static final ElasticsearchContainer elasticSearch = new ElasticsearchContainer(TestImage.ELASTICSEARCH_8.toString())
47+
static final ElasticsearchContainer elasticSearch = new ElasticsearchContainer(TestImage.ELASTICSEARCH.toString())
4848
.withPassword("my-custom-password");
4949

5050
@Autowired

0 commit comments

Comments
 (0)