Skip to content

Commit

Permalink
Deprecate support for docker.elastic.co/elasticsearch/elasticsearch-o…
Browse files Browse the repository at this point in the history
…ss (#4574)

Since version 7.11.0, there is no more `docker.elastic.co/elasticsearch/elasticsearch-oss`
artifact anymore.

---------

Co-authored-by: Eddú Meléndez Gonzales <[email protected]>
  • Loading branch information
dadoonet and eddumelendez authored Nov 30, 2023
1 parent 89e7f23 commit 1bfb966
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
9 changes: 0 additions & 9 deletions docs/modules/elasticsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ You can turn on security by providing a password:
[HttpClient](../../modules/elasticsearch/src/test/java/org/testcontainers/elasticsearch/ElasticsearchContainerTest.java) inside_block:httpClientSecuredContainer
<!--/codeinclude-->

## Choose your Elasticsearch license

If you prefer to start a Docker image with the pure OSS version (which means with no security in older versions or
other new and advanced features), you can use this instead:

<!--codeinclude-->
[Elasticsearch OSS](../../modules/elasticsearch/src/test/java/org/testcontainers/elasticsearch/ElasticsearchContainerTest.java) inside_block:ossContainer
<!--/codeinclude-->

## Adding this module to your project dependencies

Add the following dependency to your `pom.xml`/`build.gradle` file:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.testcontainers.containers.BindMode;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
import org.testcontainers.utility.Base58;
import org.testcontainers.utility.ComparableVersion;
import org.testcontainers.utility.DockerImageName;

Expand Down Expand Up @@ -60,6 +59,7 @@ public class ElasticsearchContainer extends GenericContainer<ElasticsearchContai
"docker.elastic.co/elasticsearch/elasticsearch"
);

@Deprecated
private static final DockerImageName DEFAULT_OSS_IMAGE_NAME = DockerImageName.parse(
"docker.elastic.co/elasticsearch/elasticsearch-oss"
);
Expand All @@ -72,7 +72,8 @@ public class ElasticsearchContainer extends GenericContainer<ElasticsearchContai
@Deprecated
protected static final String DEFAULT_TAG = "7.9.2";

private final boolean isOss;
@Deprecated
private boolean isOss = false;

private final boolean isAtLeastMajorVersion8;

Expand Down Expand Up @@ -103,9 +104,16 @@ public ElasticsearchContainer(String dockerImageName) {
public ElasticsearchContainer(final DockerImageName dockerImageName) {
super(dockerImageName);
dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME, DEFAULT_OSS_IMAGE_NAME, ELASTICSEARCH_IMAGE_NAME);
this.isOss = dockerImageName.isCompatibleWith(DEFAULT_OSS_IMAGE_NAME);

withNetworkAliases("elasticsearch-" + Base58.randomString(6));
if (dockerImageName.isCompatibleWith(DEFAULT_OSS_IMAGE_NAME)) {
this.isOss = true;
log.warn(
"{} is not supported anymore after 7.10.2. Please switch to {}",
dockerImageName.getUnversionedPart(),
DEFAULT_IMAGE_NAME.getUnversionedPart()
);
}

withEnv("discovery.type", "single-node");
// disable disk threshold checks
withEnv("cluster.routing.allocation.disk.threshold_enabled", "false");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ public void elasticsearchOssImage() throws IOException {
try (
// ossContainer {
ElasticsearchContainer container = new ElasticsearchContainer(
DockerImageName
.parse("docker.elastic.co/elasticsearch/elasticsearch-oss")
.withTag(ELASTICSEARCH_VERSION)
"docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2"
)
// }
) {
Expand Down Expand Up @@ -282,11 +280,7 @@ public void incompatibleSettingsTest() {
// The OSS image can not use security feature
assertThat(
catchThrowable(() -> {
new ElasticsearchContainer(
DockerImageName
.parse("docker.elastic.co/elasticsearch/elasticsearch-oss")
.withTag(ELASTICSEARCH_VERSION)
)
new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2")
.withPassword("foo");
})
)
Expand Down

0 comments on commit 1bfb966

Please sign in to comment.