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

HSEARCH-4130 Use docker containers for Elasticsearch in integration tests #2539

Merged
merged 4 commits into from Apr 14, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions CONTRIBUTING.md
Expand Up @@ -261,15 +261,6 @@ Or more simply, if your AWS credentials are already stored in `~/.aws/credential
-Dtest.elasticsearch.connection.aws.region=<Your AWS region ID>
```

When building Hibernate Search with new JDKs,
you may want to run Elasticsearch with a different JDK than the one used by Maven.
This can be done by setting a property
(**this will only work with the profiles for Elasticsearch 5 and above**):

```bash
./mvnw clean install -Dtest.elasticsearch.run.java_home=/path/to/my/jdk
```

### JQAssistant

You can request static analysis and sanity checks with the `jqassistant` profile.
Expand Down
38 changes: 0 additions & 38 deletions Jenkinsfile
Expand Up @@ -207,54 +207,42 @@ stage('Configure') {
],
esLocal: [
new EsLocalBuildEnvironment(versionRange: '[5.6,6.0)', mavenProfile: 'elasticsearch-5.6',
jdkTool: 'OpenJDK 8 Latest',
condition: TestCondition.AFTER_MERGE),
// ES 6.2, 6.3.0, 6.3.1 and 6.3.2 and below have a bug that prevents double-nested
// sorts from working: https://github.com/elastic/elasticsearch/issues/32130
new EsLocalBuildEnvironment(versionRange: '[6.0,6.2)', mavenProfile: 'elasticsearch-6.0',
jdkTool: 'OpenJDK 8 Latest',
condition: TestCondition.ON_DEMAND),
// ES 6.3 has a bug that prevents IndexingIT from passing.
// See https://github.com/elastic/elasticsearch/issues/32395
new EsLocalBuildEnvironment(versionRange: '[6.3,6.4)', mavenProfile: 'elasticsearch-6.3',
jdkTool: 'OpenJDK 8 Latest',
condition: TestCondition.ON_DEMAND),
new EsLocalBuildEnvironment(versionRange: '[6.4,6.7)', mavenProfile: 'elasticsearch-6.4',
jdkTool: 'OpenJDK 8 Latest',
condition: TestCondition.AFTER_MERGE),
// Not testing 6.7 to make the build quicker.
// The only difference with 6.8+ is a bug in field sorts that is already present in earlier versions.
new EsLocalBuildEnvironment(versionRange: '[6.7,6.8)', mavenProfile: 'elasticsearch-6.7',
jdkTool: 'OpenJDK 8 Latest',
condition: TestCondition.ON_DEMAND),
new EsLocalBuildEnvironment(versionRange: '[6.8,7.0)', mavenProfile: 'elasticsearch-6.8',
jdkTool: 'OpenJDK 8 Latest',
condition: TestCondition.AFTER_MERGE),
// Not testing 7.0/7.1/7.2 to make the build quicker.
// The only difference with 7.3+ is they have a bug in their BigInteger support.
new EsLocalBuildEnvironment(versionRange: '[7.0,7.3)', mavenProfile: 'elasticsearch-7.0',
jdkTool: 'OpenJDK 8 Latest',
condition: TestCondition.ON_DEMAND),
new EsLocalBuildEnvironment(versionRange: '[7.3,7.7)', mavenProfile: 'elasticsearch-7.3',
jdkTool: 'OpenJDK 11 Latest',
condition: TestCondition.AFTER_MERGE),
// Not testing 7.7 to make the build quicker.
// The only difference with 7.7+ is how we create templates for tests.
new EsLocalBuildEnvironment(versionRange: '[7.7,7.8)', mavenProfile: 'elasticsearch-7.7',
jdkTool: 'OpenJDK 11 Latest',
condition: TestCondition.ON_DEMAND),
// Not testing 7.9 to make the build quicker.
// The only difference with 7.10+ is an additional test for exists on null values,
// which is disabled on 7.10 but enabled on all older versions (not just 7.9).
new EsLocalBuildEnvironment(versionRange: '[7.8,7.10)', mavenProfile: 'elasticsearch-7.8',
jdkTool: 'OpenJDK 11 Latest',
condition: TestCondition.AFTER_MERGE),
new EsLocalBuildEnvironment(versionRange: '[7.10,7.11)', mavenProfile: 'elasticsearch-7.10',
jdkTool: 'OpenJDK 11 Latest',
condition: TestCondition.BEFORE_MERGE,
isDefault: true),
new EsLocalBuildEnvironment(versionRange: '[7.11,7.x)', mavenProfile: 'elasticsearch-7.11',
jdkTool: 'OpenJDK 11 Latest',
condition: TestCondition.AFTER_MERGE)
],
// Note that each of these environments will only be tested if the appropriate
Expand Down Expand Up @@ -464,7 +452,6 @@ stage('Default build') {
-Pdist -Pcoverage -Pjqassistant \
${enableDefaultBuildIT ? '' : '-DskipITs'} \
${toTestJdkArg(environments.content.jdk.default)} \
${toElasticsearchJdkArg(environments.content.jdk.default)} \
"""

// Don't try to report to Coveralls.io or SonarCloud if coverage data is missing
Expand Down Expand Up @@ -760,10 +747,6 @@ abstract class BuildEnvironment {
String getMavenJdkTool(def allEnvironments) {
allEnvironments.content.jdk.default.buildJdkTool
}

String getElasticsearchJdkTool(def allEnvironments) {
allEnvironments.content.esLocal.default.jdkTool
}
}

class JdkBuildEnvironment extends BuildEnvironment {
Expand Down Expand Up @@ -797,13 +780,8 @@ class DatabaseBuildEnvironment extends BuildEnvironment {
class EsLocalBuildEnvironment extends BuildEnvironment {
String versionRange
String mavenProfile
String jdkTool
@Override
String getTag() { "elasticsearch-local-$versionRange" }
@Override
String getElasticsearchJdkTool(def allEnvironments) {
jdkTool
}
}

class EsAwsBuildEnvironment extends BuildEnvironment {
Expand All @@ -814,10 +792,6 @@ class EsAwsBuildEnvironment extends BuildEnvironment {
boolean staticCredentials = false
@Override
String getTag() { "elasticsearch-aws-$version" + (staticCredentials ? "-credentials-static" : "") }
@Override
String getElasticsearchJdkTool(def allEnvironments) {
null // No JDK needed for Elasticsearch: the Elasticsearch instance is remote.
}
String getNameEmbeddableVersion() {
version.replaceAll('\\.', '')
}
Expand Down Expand Up @@ -921,7 +895,6 @@ void mavenNonDefaultBuild(BuildEnvironment buildEnv, String args, String project
sh """ \
mvn -Dsurefire.environment=$testSuffix \
${toTestJdkArg(buildEnv)} \
${toElasticsearchJdkArg(buildEnv)} \
--fail-at-end \
$args \
"""
Expand Down Expand Up @@ -965,14 +938,3 @@ String toTestJdkArg(BuildEnvironment buildEnv) {

return args
}

String toElasticsearchJdkArg(BuildEnvironment buildEnv) {
String elasticsearchJdkTool = buildEnv.getElasticsearchJdkTool(environments)

if (elasticsearchJdkTool == null || buildEnv.getMavenJdkTool(environments) == elasticsearchJdkTool) {
return '' // No specific JDK needed
}

def elasticsearchJdkToolPath = tool(name: elasticsearchJdkTool, type: 'jdk')
return "-Dtest.elasticsearch.run.java_home=$elasticsearchJdkToolPath"
}
5 changes: 2 additions & 3 deletions documentation/pom.xml
Expand Up @@ -115,8 +115,8 @@
</testResources>
<plugins>
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -169,7 +169,6 @@
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!-- Inherit execution unpack-shared-test-build-resources -->
<execution>
<id>unpack-asciidoctor-theme</id>
<phase>generate-resources</phase>
Expand Down
4 changes: 2 additions & 2 deletions integrationtest/backend/elasticsearch/pom.xml
Expand Up @@ -95,8 +95,8 @@
</executions>
</plugin>
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Expand Down
4 changes: 2 additions & 2 deletions integrationtest/jdk/java-modules/pom.xml
Expand Up @@ -69,8 +69,8 @@
</executions>
</plugin>
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Expand Down
4 changes: 2 additions & 2 deletions integrationtest/mapper/orm-batch-jsr352/pom.xml
Expand Up @@ -186,8 +186,8 @@
</plugin>

<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Expand Down
4 changes: 2 additions & 2 deletions integrationtest/mapper/orm-realbackend/pom.xml
Expand Up @@ -135,8 +135,8 @@
</executions>
</plugin>
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Expand Down
4 changes: 2 additions & 2 deletions integrationtest/mapper/orm-spring/pom.xml
Expand Up @@ -134,8 +134,8 @@
</executions>
</plugin>
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Expand Down
4 changes: 2 additions & 2 deletions integrationtest/performance/backend/elasticsearch/pom.xml
Expand Up @@ -56,8 +56,8 @@
</executions>
</plugin>
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.bsc.maven</groupId>
Expand Down
4 changes: 2 additions & 2 deletions integrationtest/showcase/library/pom.xml
Expand Up @@ -185,8 +185,8 @@
</executions>
</plugin>
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Expand Down