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

Switch from elasticearch-maven-plugin to docker-maven-plugin to start Elasticsearch for ITs #11599

Merged
merged 3 commits into from
Aug 26, 2020
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
17 changes: 15 additions & 2 deletions .github/workflows/ci-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ on:
env:
# Workaround testsuite locale issue
LANG: en_US.UTF-8
NATIVE_TEST_MAVEN_OPTS: "-B --settings .github/mvn-settings.xml --fail-at-end -Dquarkus.native.container-build=true -Dtest-postgresql -Dtest-elasticsearch -Dtest-keycloak -Dtest-amazon-services -Dtest-db2 -Dtest-mysql -Dtest-mariadb -Dmariadb.base_url='jdbc:mariadb://localhost:3308' -Dmariadb.url='jdbc:mariadb://localhost:3308/hibernate_orm_test' -Dtest-mssql -Dtest-vault -Dtest-neo4j -Dtest-kafka -Dtest-redis -Dnative-image.xmx=5g -Dnative -Dnative.surefire.skip -Dformat.skip -Dno-descriptor-tests install"
JVM_TEST_MAVEN_OPTS: "-e -B --settings .github/mvn-settings.xml -Dtest-postgresql -Dtest-elasticsearch -Dtest-db2 -Dtest-mysql -Dtest-mariadb -Dmariadb.base_url='jdbc:mariadb://localhost:3308' -Dmariadb.url='jdbc:mariadb://localhost:3308/hibernate_orm_test' -Dtest-mssql -Dtest-amazon-services -Dtest-vault -Dtest-neo4j -Dtest-kafka -Dtest-keycloak -Dtest-redis -Dformat.skip"
NATIVE_TEST_MAVEN_OPTS: "-B --settings .github/mvn-settings.xml --fail-at-end -Dquarkus.native.container-build=true -Dtest-postgresql -Dtest-elasticsearch -Delasticsearch.hosts='localhost:9200' -Dtest-keycloak -Dtest-amazon-services -Dtest-db2 -Dtest-mysql -Dtest-mariadb -Dmariadb.base_url='jdbc:mariadb://localhost:3308' -Dmariadb.url='jdbc:mariadb://localhost:3308/hibernate_orm_test' -Dtest-mssql -Dtest-vault -Dtest-neo4j -Dtest-kafka -Dtest-redis -Dnative-image.xmx=5g -Dnative -Dnative.surefire.skip -Dformat.skip -Dno-descriptor-tests install"
JVM_TEST_MAVEN_OPTS: "-e -B --settings .github/mvn-settings.xml -Dtest-postgresql -Dtest-elasticsearch -Delasticsearch.hosts='localhost:9200' -Dtest-db2 -Dtest-mysql -Dtest-mariadb -Dmariadb.base_url='jdbc:mariadb://localhost:3308' -Dmariadb.url='jdbc:mariadb://localhost:3308/hibernate_orm_test' -Dtest-mssql -Dtest-amazon-services -Dtest-vault -Dtest-neo4j -Dtest-kafka -Dtest-keycloak -Dtest-redis -Dformat.skip"
DB_USER: hibernate_orm_test
DB_PASSWORD: hibernate_orm_test
DB_NAME: hibernate_orm_test
Expand Down Expand Up @@ -181,6 +181,12 @@ jobs:
image: redis:5.0.8-alpine
ports:
- 127.0.0.1:6379:6379
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.8.0
env:
discovery.type: single-node
ports:
- 127.0.0.1:9200:9200
steps:
- name: Start mysql
shell: bash
Expand Down Expand Up @@ -444,6 +450,7 @@ jobs:
hibernate-reactive-postgresql
- category: Data6
postgres: "true"
elasticsearch: "true"
timeout: 40
test-modules: >
elasticsearch-rest-client
Expand Down Expand Up @@ -609,6 +616,12 @@ jobs:
-Dkeycloak.profile.feature.upload_scripts=enabled" \
-d quay.io/keycloak/keycloak:11.0.1
if: matrix.keycloak
- name: Elasticsearch Service
run: |
docker run --rm --publish 9200:9200 --name build-elasticsearch \
-e discovery.type=single-node \
-d docker.elastic.co/elasticsearch/elasticsearch-oss:7.8.0
if: matrix.elasticsearch
- uses: actions/checkout@v2
- name: Set up JDK 11
# Uses sha for added security since tags can be updated
Expand Down
15 changes: 5 additions & 10 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

<properties>
<!-- Maven plugin versions -->
<elasticsearch-maven-plugin.version>6.15</elasticsearch-maven-plugin.version>
<elasticsearch-server.version>7.8.0</elasticsearch-server.version>
<scala-maven-plugin.version>4.1.1</scala-maven-plugin.version>

<!-- These properties are needed in order for them to be resolvable by the generated projects -->
Expand Down Expand Up @@ -75,6 +73,11 @@
<!-- Antlr is used by the PanacheQL parser-->
<antlr.version>4.7.2</antlr.version>

<!-- Defaults for integration tests -->
<elasticsearch-server.version>7.8.0</elasticsearch-server.version>
<elasticsearch.image>docker.elastic.co/elasticsearch/elasticsearch-oss:${elasticsearch-server.version}</elasticsearch.image>
<elasticsearch.protocol>http</elasticsearch.protocol>

<!-- Align various dependencies that are not really part of the bom-->
<findbugs.version>3.0.2</findbugs.version>
<jsoup.version>1.11.3</jsoup.version>
Expand Down Expand Up @@ -484,14 +487,6 @@
<parameters>true</parameters>
</configuration>
</plugin>
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
<version>${elasticsearch-maven-plugin.version}</version>
<configuration>
<version>${elasticsearch-server.version}</version>
</configuration>
</plugin>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
Expand Down
83 changes: 74 additions & 9 deletions integration-tests/elasticsearch-rest-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
Expand Down Expand Up @@ -91,35 +97,94 @@
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>docker-elasticsearch</id>
<activation>
<property>
<name>docker</name>
</property>
</activation>
<properties>
<elasticsearch.hosts>localhost:9200</elasticsearch.hosts>
<elasticsearch.protocol>http</elasticsearch.protocol>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<timeout>90</timeout>
<pathConf>${project.build.directory}/test-classes/elasticsearch-maven-plugin/configuration/</pathConf>
<autoCreateIndex>true</autoCreateIndex>
<images>
<image>
<name>${elasticsearch.image}</name>
<alias>elasticsearch</alias>
<run>
<env>
<discovery.type>single-node</discovery.type>
</env>
<ports>
<port>9200:9200</port>
</ports>
<log>
<prefix>Elasticsearch: </prefix>
<date>default</date>
<color>cyan</color>
</log>
<wait>
<http>
<url>http://localhost:9200</url>
<method>GET</method>
<status>200</status>
</http>
<time>20000</time>
</wait>
</run>
</image>
</images>
<allContainers>true</allContainers>
</configuration>
<!-- Different executions from 2.x: the "start" goal has been renamed in version 5 -->
<executions>
<execution>
<id>start-elasticsearch</id>
<id>docker-start</id>
<phase>process-test-classes</phase>
<goals>
<goal>runforked</goal>
<goal>stop</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-elasticsearch</id>
<id>docker-stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>docker-prune</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/../../.github/docker-prune.sh</executable>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I just learned about this script.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copy-pasted that from another pom file. Not sure it's useful, but well... that's how it works everywhere else 🤷

</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>native</id>
<activation>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
quarkus.elasticsearch.hosts=localhost:9200
quarkus.elasticsearch.hosts=${elasticsearch.hosts}
quarkus.elasticsearch.protocol=${elasticsearch.protocol}
quarkus.elasticsearch.socket-timeout=10S
quarkus.elasticsearch.discovery.enabled=true
quarkus.elasticsearch.discovery.refresh-interval=1M

This file was deleted.

Loading