Skip to content

Commit

Permalink
HSEARCH-4174 Remove hardcoded ES version from ElasticsearchBootstrapIT
Browse files Browse the repository at this point in the history
So that we don't have to update it each time we upgrade ES.

Signed-off-by: Yoann Rodière <yoann@hibernate.org>
  • Loading branch information
yrodiere committed Mar 1, 2021
1 parent ca3de3c commit fa99046
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -9,6 +9,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import org.hibernate.search.backend.elasticsearch.ElasticsearchVersion;
import org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchBackendSettings;
import org.hibernate.search.backend.elasticsearch.cfg.spi.ElasticsearchBackendSpiSettings;
import org.hibernate.search.backend.elasticsearch.client.spi.ElasticsearchRequest;
Expand Down Expand Up @@ -101,13 +102,16 @@ public void explicitProtocolDialect_noVersionCheck() {
@Test
@TestForIssue(jiraKey = "HSEARCH-3841")
public void explicitProtocolDialect_noVersionCheck_incompleteVersion() {
ElasticsearchVersion clusterVersion = ElasticsearchVersion.of( ElasticsearchTestDialect.getClusterVersion() );
String versionWithMajorOnly = String.valueOf( clusterVersion.major() );

assertThatThrownBy(
() -> setupHelper.start()
.withBackendProperty(
ElasticsearchBackendSettings.VERSION_CHECK_ENABLED, false
)
.withBackendProperty(
ElasticsearchBackendSettings.VERSION, "7"
ElasticsearchBackendSettings.VERSION, versionWithMajorOnly
)
.withBackendProperty(
ElasticsearchBackendSpiSettings.CLIENT_FACTORY,
Expand Down Expand Up @@ -135,12 +139,16 @@ public void explicitProtocolDialect_noVersionCheck_incompleteVersion() {
@Test
@TestForIssue(jiraKey = "HSEARCH-3841")
public void explicitProtocolDialect_noVersionCheck_completeVersion() {
ElasticsearchVersion clusterVersion = ElasticsearchVersion.of( ElasticsearchTestDialect.getClusterVersion() );
String versionWithMajorAndMinorOnly = String.valueOf( clusterVersion.major() )
+ "." + String.valueOf( clusterVersion.minor().getAsInt() );

SearchSetupHelper.PartialSetup partialSetup = setupHelper.start()
.withBackendProperty(
ElasticsearchBackendSettings.VERSION_CHECK_ENABLED, false
)
.withBackendProperty(
ElasticsearchBackendSettings.VERSION, "7.10"
ElasticsearchBackendSettings.VERSION, versionWithMajorAndMinorOnly
)
.withBackendProperty(
ElasticsearchBackendSpiSettings.CLIENT_FACTORY,
Expand Down

0 comments on commit fa99046

Please sign in to comment.