Skip to content

feat(ci): split integration tests execution by category #2548

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

Merged
merged 6 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build

env:
MAVEN_ARGS: -V -ntp -e

on:
workflow_call:

jobs:
integration_tests:
strategy:
matrix:
java: [ 17, 21 ]
kubernetes: [ 'v1.28.14', 'v1.29.9','1.30.5', '1.31.1' ]
it-category: [ 'baseapi', 'dependent', 'workflow' ]
httpclient: [ 'vertx', 'jdk', 'jetty' ]
uses: ./.github/workflows/integration-tests.yml
with:
java-version: ${{ matrix.java }}
kube-version: ${{ matrix.kubernetes }}
it-category: ${{ matrix.it-category }}
http-client: ${{ matrix.httpclient }}

special_integration_tests:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 17, 21 ]
steps:
- uses: actions/checkout@v4
- name: Set up Java and Maven
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}
- name: Run Special Integration Tests
run: ./mvnw ${MAVEN_ARGS} -B package -P minimal-watch-timeout-dependent-it --file pom.xml
42 changes: 2 additions & 40 deletions .github/workflows/fabric8-next-version-schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,8 @@ jobs:
with:
distribution: temurin
java-version: 17
cache: 'maven'
- name: Run unit tests
run: ./mvnw ${MAVEN_ARGS} clean install --file pom.xml

integration_tests:
strategy:
matrix:
java: [ 11, 17 ]
kubernetes: ['v1.28.12', 'v1.29.7','1.30.3', '1.31.0']
uses: ./.github/workflows/integration-tests.yml
with:
java-version: ${{ matrix.java }}
kube-version: ${{ matrix.kubernetes }}

httpclient-tests:
strategy:
matrix:
httpclient: [ 'vertx', 'jdk', 'jetty' ]
uses: ./.github/workflows/integration-tests.yml
with:
java-version: 17
kube-version: 'v1.29.1'
http-client: ${{ matrix.httpclient }}
experimental: true
checkout-ref: 'fabric8-next-version'

special_integration_tests:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11, 17 ]
steps:
- uses: actions/checkout@v4
with:
ref: 'fabric8-next-version'
- name: Set up Java and Maven
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Run Special Integration Tests
run: ./mvnw ${MAVEN_ARGS} -B package -P minimal-watch-timeout-dependent-it --file pom.xml
build:
uses: ./.github/workflows/build.yml
20 changes: 16 additions & 4 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ on:
type: string
required: false
default: ''
it-category:
type: string
required: false
default: ''

jobs:
integration_tests:
Expand All @@ -42,9 +46,17 @@ jobs:
- name: Set up Minikube
uses: manusa/actions-setup-minikube@v2.12.0
with:
minikube version: v1.33.0
kubernetes version: ${{ inputs.kube-version }}
minikube version: 'v1.33.0'
kubernetes version: '${{ inputs.kube-version }}'
driver: 'docker'
github token: ${{ secrets.GITHUB_TOKEN }}
- name: Run integration tests
run: ./mvnw ${MAVEN_ARGS} -B package -P no-unit-tests -Dfabric8-httpclient-impl.name=${{inputs.http-client}} --file pom.xml
- name: "${{inputs.it-category}} integration tests (kube: ${{ inputs.kube-version }} / java: ${{ inputs.java-version }} / client: ${{ inputs.http-client }})"
run: |
if [ -z "${{inputs.it-category}}" ]; then
it_profile="integration-tests"
else
it_profile="integration-tests-${{inputs.it-category}}"
fi
echo "Using profile: ${it_profile}"
./mvnw ${MAVEN_ARGS} -B install -DskipTests -Pno-apt --file pom.xml
./mvnw ${MAVEN_ARGS} -B package -T1C -P${it_profile} -Dfabric8-httpclient-impl.name=${{inputs.http-client}} --file pom.xml
40 changes: 3 additions & 37 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,41 +28,7 @@ jobs:
run: |
./mvnw ${MAVEN_ARGS} spotless:check --file pom.xml
- name: Run unit tests
run: ./mvnw ${MAVEN_ARGS} clean install --file pom.xml
run: ./mvnw ${MAVEN_ARGS} clean install -Pno-apt --file pom.xml

integration_tests:
strategy:
matrix:
java: [ 17, 21 ]
kubernetes: [ 'v1.28.12', 'v1.29.7','1.30.3', '1.31.0' ]
uses: ./.github/workflows/integration-tests.yml
with:
java-version: ${{ matrix.java }}
kube-version: ${{ matrix.kubernetes }}

httpclient-tests:
strategy:
matrix:
httpclient: [ 'vertx', 'jdk', 'jetty' ]
uses: ./.github/workflows/integration-tests.yml
with:
java-version: 17
kube-version: 'v1.29.1'
http-client: ${{ matrix.httpclient }}
experimental: true

special_integration_tests:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 17, 21 ]
steps:
- uses: actions/checkout@v4
- name: Set up Java and Maven
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Run Special Integration Tests
run: ./mvnw ${MAVEN_ARGS} -B package -P minimal-watch-timeout-dependent-it --file pom.xml
build:
uses: ./.github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.fabric8.kubernetes.api.model.ConfigMap;
import io.fabric8.kubernetes.api.model.HasMetadata;
Expand All @@ -20,6 +23,7 @@
import static org.mockito.Mockito.*;

class WorkflowReconcileExecutorTest extends AbstractWorkflowExecutorTest {
private static final Logger log = LoggerFactory.getLogger(WorkflowReconcileExecutorTest.class);

@SuppressWarnings("unchecked")
Context<TestCustomResource> mockContext = mock(Context.class);
Expand All @@ -30,7 +34,8 @@ class WorkflowReconcileExecutorTest extends AbstractWorkflowExecutorTest {

@BeforeEach
@SuppressWarnings("unchecked")
void setup() {
void setup(TestInfo testInfo) {
log.debug("==> Starting test {}", testInfo.getDisplayName());
when(mockContext.getWorkflowExecutorService()).thenReturn(executorService);
when(mockContext.eventSourceRetriever()).thenReturn(mock(EventSourceRetriever.class));
}
Expand Down
10 changes: 4 additions & 6 deletions operator-framework/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@
<artifactId>compile-testing</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>crd-generator-apt</artifactId>
<scope>test</scope>
</dependency>
<!-- This is just here to make some special test using Route, Openshift is actually not used in tests -->
<dependency>
<groupId>io.fabric8</groupId>
Expand Down Expand Up @@ -113,7 +108,10 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
116 changes: 111 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<compilerArgs>
<arg>-Aio.fabric8.crd.generator.parallel=true</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -275,6 +280,23 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<!-- Summary output for tests at the end -->
<configuration>
<reportFormat>plain</reportFormat>
<consoleOutputReporter>
<disable>true</disable>
</consoleOutputReporter>
<statelessTestsetInfoReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter">
<theme>UNICODE</theme>
</statelessTestsetInfoReporter>
</configuration>
<dependencies>
<dependency>
<groupId>me.fabriciorby</groupId>
<artifactId>maven-surefire-junit5-tree-reporter</artifactId>
<version>1.3.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -349,33 +371,103 @@
</build>
<profiles>
<profile>
<id>all-tests</id>
<id>integration-tests</id>
<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>crd-generator-apt</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
<include>**/*IT.java</include>
<include>**/*E2E.java</include>
</includes>
<excludes>
<exclude>**/*Test.java</exclude>
<exclude>**/*E2E.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>no-unit-tests</id>
<id>integration-tests-baseapi</id>
<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>crd-generator-apt</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*IT.java</include>
<include>io/javaoperatorsdk/operator/baseapi/**/*IT.java</include>
</includes>
<excludes>
<exclude>**/*Test.java</exclude>
<exclude>**/*E2E.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration-tests-dependent</id>
<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>crd-generator-apt</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>io/javaoperatorsdk/operator/dependent/**/*IT.java</include>
</includes>
<excludes>
<exclude>**/*Test.java</exclude>
<exclude>**/*E2E.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration-tests-workflow</id>
<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>crd-generator-apt</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>io/javaoperatorsdk/operator/workflow/**/*IT.java</include>
</includes>
<excludes>
<exclude>**/*Test.java</exclude>
Expand All @@ -389,6 +481,13 @@
<!-- Special category of tests. See usage in source code. -->
<profile>
<id>minimal-watch-timeout-dependent-it</id>
<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>crd-generator-apt</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
Expand All @@ -410,6 +509,13 @@
</profile>
<profile>
<id>end-to-end-tests</id>
<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>crd-generator-apt</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
Expand Down
Loading