use failsafe plugin for integration tests instead of "offline" profile

This commit is contained in:
Stefan Kalscheuer 2021-11-21 11:19:08 +01:00
parent 4045b1a4fd
commit b4a822bf10
4 changed files with 26 additions and 21 deletions

View File

@ -16,7 +16,7 @@ steps:
- name: unit-tests - name: unit-tests
image: maven:3-jdk-11 image: maven:3-jdk-11
commands: commands:
- mvn -B resources:testResources compiler:testCompile surefire:test -P offline-tests - mvn -B test
when: when:
branch: branch:
- develop - develop
@ -32,7 +32,7 @@ steps:
- unzip vault_1.9.0_linux_amd64.zip - unzip vault_1.9.0_linux_amd64.zip
- rm vault_1.9.0_linux_amd64.zip - rm vault_1.9.0_linux_amd64.zip
- mv vault /bin/ - mv vault /bin/
- mvn -B resources:testResources compiler:testCompile surefire:test - mvn -B -P integration-test verify
when: when:
branch: branch:
- main - main

View File

@ -21,6 +21,8 @@ jobs:
with: with:
java-version: ${{ matrix.jdk }} java-version: ${{ matrix.jdk }}
distribution: 'temurin' distribution: 'temurin'
- name: Compile
run: mvn -B clean compile
- name: Set up Vault - name: Set up Vault
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')
run: | run: |
@ -29,14 +31,14 @@ jobs:
unzip "vault_${{ matrix.vault }}_linux_amd64.zip" unzip "vault_${{ matrix.vault }}_linux_amd64.zip"
rm "vault_${{ matrix.vault }}_linux_amd64.zip" rm "vault_${{ matrix.vault }}_linux_amd64.zip"
sudo mv vault /usr/bin/vault sudo mv vault /usr/bin/vault
- name: Test - name: Test (Unit & Integration)
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')
env: env:
VAULT_VERSION: ${{ matrix.vault }} VAULT_VERSION: ${{ matrix.vault }}
run: mvn -B -P coverage clean verify run: mvn -B -P coverage -P integration-test verify
- name: Test (offline) - name: Test (Unit)
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/release/') if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/release/')
run: mvn -B -P offline-tests -P coverage clean verify run: mvn -B -P coverage verify
- name: Analysis - name: Analysis
if: matrix.analysis && github.event_name == 'push' if: matrix.analysis && github.event_name == 'push'
run: > run: >

18
pom.xml
View File

@ -266,19 +266,23 @@
</profile> </profile>
<profile> <profile>
<id>offline-tests</id> <id>integration-test</id>
<build> <build>
<pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
<configuration> <version>2.22.2</version>
<excludedGroups>online</excludedGroups> <executions>
</configuration> <execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement>
</build> </build>
</profile> </profile>

View File

@ -48,8 +48,7 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue;
* @author Stefan Kalscheuer * @author Stefan Kalscheuer
* @since 0.1 * @since 0.1
*/ */
@Tag("online") class HTTPVaultConnectorIT {
class HTTPVaultConnectorTest {
private static String VAULT_VERSION = "1.9.0"; // The vault version this test is supposed to run against. private static String VAULT_VERSION = "1.9.0"; // The vault version this test is supposed to run against.
private static final String KEY1 = "E38bkCm0VhUvpdCKGQpcohhD9XmcHJ/2hreOSY019Lho"; private static final String KEY1 = "E38bkCm0VhUvpdCKGQpcohhD9XmcHJ/2hreOSY019Lho";
private static final String KEY2 = "O5OHwDleY3IiPdgw61cgHlhsrEm6tVJkrxhF6QAnILd1"; private static final String KEY2 = "O5OHwDleY3IiPdgw61cgHlhsrEm6tVJkrxhF6QAnILd1";