Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate support for docker.elastic.co/elasticsearch/elasticsearch-oss #4574

Merged
merged 6 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading