Skip to content

Commit

Permalink
Feat/#502 consul integrate test (#503)
Browse files Browse the repository at this point in the history
* Fixed the scope caching error

* Added dependence of container test into pom

* Moved the test cases to server module

* Enhanced the registry test with testContainer.

* Migrate consul container test to integration folder

* Reverted unnecessary change

* Changed name

* Disable the integration test for mvn clean install

* Removed unused line

* -now integration test will copy the config under its own integration folder to the target folder
-CURD some config files due to fix test cases (those were not configured correctly in previous versions)

* -move integration plugins to integration-test profile
-test configs will be generated either from integration folder or under test folder depends on the profile, cannot include both because file with same name will have only one copy under config directory in phase "generate-test-sources".
-when run mvn clean install will as usual, when run mvn clean install -P integration-test will execute integration tests

* fixes the typo

* update travis to jdk11
  • Loading branch information
jiachen1120 authored and stevehu committed Jun 14, 2019
1 parent 95a988d commit 2638299
Show file tree
Hide file tree
Showing 15 changed files with 499 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cache:
- $HOME/.m2

jdk:
- oraclejdk8
- openjdk11

after_success:
- bash <(curl -s https://codecov.io/bash)
142 changes: 99 additions & 43 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@
<version.build-helper-maven>3.0.0</version.build-helper-maven>
<version.lifecycle-mapping>1.0.0</version.lifecycle-mapping>
<version.maven-gpg>1.6</version.maven-gpg>
<version.testcontainers>1.8.0</version.testcontainers>
<skip.unit.tests>false</skip.unit.tests>
<matched.test.resources>**/*</matched.test.resources>
<version.javadoc-packagelist-plugin>1.0.0</version.javadoc-packagelist-plugin>
<version.maven-javadoc>3.1.0</version.maven-javadoc>
</properties>
Expand Down Expand Up @@ -470,7 +473,7 @@
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_common</artifactId>
<version>${version.prometheus}</version>
</dependency>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
Expand Down Expand Up @@ -606,6 +609,12 @@
<version>${version.httpclient}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>${version.testcontainers}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand All @@ -626,7 +635,7 @@
<filtering>false</filtering>
<directory>${basedir}/src/test/resources</directory>
<includes>
<include>**/*</include>
<include>${matched.test.resources}</include>
</includes>
</testResource>
</testResources>
Expand Down Expand Up @@ -713,6 +722,14 @@
<version>${version.maven-surefire}</version>
</dependency>
</dependencies>
<configuration>
<!-- Skips unit tests if the value of skip.unit.tests property is true -->
<skipTests>${skip.unit.tests}</skipTests>
<!-- Excludes integration tests when unit tests are run -->
<excludes>
<exclude>**/*IT.java</exclude>
</excludes>
</configuration>
</plugin>

<plugin>
Expand All @@ -723,47 +740,6 @@
<encoding>UTF-8</encoding>
<forkCount>0</forkCount>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${version.build-helper-maven}</version>
<executions>
<execution>
<id>add-test-source</id>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}\src\integration\java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-resource</id>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<!-- Don't forget <directory> label -->
<directory>${project.basedir}\src\integration\resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- JACOCO added for code coverage -->
<plugin>
Expand Down Expand Up @@ -862,6 +838,12 @@
<profiles>
<profile>
<id>dev</id>
<properties>
<!--
Only unit tests are run when the development profile is active
-->
<skip.unit.tests>false</skip.unit.tests>
</properties>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -932,5 +914,79 @@
</plugins>
</build>
</profile>
<!-- The Configuration of the integration-test profile -->
<profile>
<id>integration-test</id>
<properties>
<!--
Only integration tests are run when the integration-test profile is active
-->
<skip.unit.tests>true</skip.unit.tests>
<!--to include nothing for regular unit resources-->
<matched.test.resources>a^</matched.test.resources>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.maven-surefire}</version>
<executions>
<!--
Invokes both the integration-test and the verify goals of the
Failsafe Maven plugin
-->
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<!--
Skips integration tests if the value of skip.integration.tests
property is true
-->
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${version.build-helper-maven}</version>
<executions>
<execution>
<id>add-integration-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/src/integration/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-integration-test-resource</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<!-- Don't forget <directory> label -->
<directory>${project.basedir}/src/integration/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
5 changes: 5 additions & 0 deletions server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Loading

0 comments on commit 2638299

Please sign in to comment.