Skip to content

Commit a43d482

Browse files
committed
feat(build): split ITs by category, parallel CRD generation
Also avoid generating CRDs when not needed by default, summarizes test results. Signed-off-by: Chris Laprun <claprun@redhat.com>
1 parent 3dd77c1 commit a43d482

File tree

7 files changed

+179
-93
lines changed

7 files changed

+179
-93
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build
2+
3+
env:
4+
MAVEN_ARGS: -V -ntp -e
5+
6+
on:
7+
workflow_call:
8+
9+
jobs:
10+
integration_tests:
11+
strategy:
12+
matrix:
13+
java: [ 17, 21 ]
14+
kubernetes: [ 'v1.28.14', 'v1.29.9','1.30.5', '1.31.1' ]
15+
it-category: [ 'baseapi', 'dependent', 'workflow' ]
16+
httpclient: [ 'vertx', 'jdk', 'jetty' ]
17+
uses: ./.github/workflows/integration-tests.yml
18+
with:
19+
java-version: ${{ matrix.java }}
20+
kube-version: ${{ matrix.kubernetes }}
21+
it-category: ${{ matrix.it-category }}
22+
http-client: ${{ matrix.httpclient }}
23+
24+
special_integration_tests:
25+
runs-on: ubuntu-latest
26+
strategy:
27+
matrix:
28+
java: [ 17, 21 ]
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Set up Java and Maven
32+
uses: actions/setup-java@v4
33+
with:
34+
distribution: temurin
35+
java-version: ${{ matrix.java }}
36+
- name: Run Special Integration Tests
37+
run: ./mvnw ${MAVEN_ARGS} -B package -P minimal-watch-timeout-dependent-it --file pom.xml

.github/workflows/fabric8-next-version-schedule.yml

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -23,46 +23,8 @@ jobs:
2323
with:
2424
distribution: temurin
2525
java-version: 17
26-
cache: 'maven'
2726
- name: Run unit tests
2827
run: ./mvnw ${MAVEN_ARGS} clean install --file pom.xml
2928

30-
integration_tests:
31-
strategy:
32-
matrix:
33-
java: [ 11, 17 ]
34-
kubernetes: ['v1.28.12', 'v1.29.7','1.30.3', '1.31.0']
35-
uses: ./.github/workflows/integration-tests.yml
36-
with:
37-
java-version: ${{ matrix.java }}
38-
kube-version: ${{ matrix.kubernetes }}
39-
40-
httpclient-tests:
41-
strategy:
42-
matrix:
43-
httpclient: [ 'vertx', 'jdk', 'jetty' ]
44-
uses: ./.github/workflows/integration-tests.yml
45-
with:
46-
java-version: 17
47-
kube-version: 'v1.29.1'
48-
http-client: ${{ matrix.httpclient }}
49-
experimental: true
50-
checkout-ref: 'fabric8-next-version'
51-
52-
special_integration_tests:
53-
runs-on: ubuntu-latest
54-
strategy:
55-
matrix:
56-
java: [ 11, 17 ]
57-
steps:
58-
- uses: actions/checkout@v4
59-
with:
60-
ref: 'fabric8-next-version'
61-
- name: Set up Java and Maven
62-
uses: actions/setup-java@v4
63-
with:
64-
distribution: temurin
65-
java-version: ${{ matrix.java }}
66-
cache: 'maven'
67-
- name: Run Special Integration Tests
68-
run: ./mvnw ${MAVEN_ARGS} -B package -P minimal-watch-timeout-dependent-it --file pom.xml
29+
build:
30+
uses: ./.github/workflows/build.yml

.github/workflows/integration-tests.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ on:
2121
type: string
2222
required: false
2323
default: ''
24+
it-category:
25+
type: string
26+
required: false
27+
default: ''
2428

2529
jobs:
2630
integration_tests:
@@ -42,9 +46,17 @@ jobs:
4246
- name: Set up Minikube
4347
uses: manusa/actions-setup-minikube@v2.12.0
4448
with:
45-
minikube version: v1.33.0
46-
kubernetes version: ${{ inputs.kube-version }}
49+
minikube version: 'v1.33.0'
50+
kubernetes version: '${{ inputs.kube-version }}'
4751
driver: 'docker'
4852
github token: ${{ secrets.GITHUB_TOKEN }}
49-
- name: Run integration tests
50-
run: ./mvnw ${MAVEN_ARGS} -B package -P no-unit-tests -Dfabric8-httpclient-impl.name=${{inputs.http-client}} --file pom.xml
53+
- name: "${{inputs.it-category}} integration tests (kube: ${{ inputs.kube-version }} / java: ${{ inputs.java-version }} / client: ${{ inputs.http-client }})"
54+
run: |
55+
if [ -z "${{inputs.it-category}}" ]; then
56+
it_profile="integration-tests"
57+
else
58+
it_profile="integration-tests-${{inputs.it-category}}"
59+
fi
60+
echo "Using profile: ${it_profile}"
61+
./mvnw ${MAVEN_ARGS} -B install -DskipTests -Pno-apt --file pom.xml
62+
./mvnw ${MAVEN_ARGS} -B package -T1C -P${it_profile} -Dfabric8-httpclient-impl.name=${{inputs.http-client}} --file pom.xml

.github/workflows/pr.yml

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -28,41 +28,7 @@ jobs:
2828
run: |
2929
./mvnw ${MAVEN_ARGS} spotless:check --file pom.xml
3030
- name: Run unit tests
31-
run: ./mvnw ${MAVEN_ARGS} clean install --file pom.xml
31+
run: ./mvnw ${MAVEN_ARGS} clean install -Pno-apt --file pom.xml
3232

33-
integration_tests:
34-
strategy:
35-
matrix:
36-
java: [ 17, 21 ]
37-
kubernetes: [ 'v1.28.12', 'v1.29.7','1.30.3', '1.31.0' ]
38-
uses: ./.github/workflows/integration-tests.yml
39-
with:
40-
java-version: ${{ matrix.java }}
41-
kube-version: ${{ matrix.kubernetes }}
42-
43-
httpclient-tests:
44-
strategy:
45-
matrix:
46-
httpclient: [ 'vertx', 'jdk', 'jetty' ]
47-
uses: ./.github/workflows/integration-tests.yml
48-
with:
49-
java-version: 17
50-
kube-version: 'v1.29.1'
51-
http-client: ${{ matrix.httpclient }}
52-
experimental: true
53-
54-
special_integration_tests:
55-
runs-on: ubuntu-latest
56-
strategy:
57-
matrix:
58-
java: [ 17, 21 ]
59-
steps:
60-
- uses: actions/checkout@v4
61-
- name: Set up Java and Maven
62-
uses: actions/setup-java@v4
63-
with:
64-
distribution: temurin
65-
java-version: ${{ matrix.java }}
66-
cache: 'maven'
67-
- name: Run Special Integration Tests
68-
run: ./mvnw ${MAVEN_ARGS} -B package -P minimal-watch-timeout-dependent-it --file pom.xml
33+
build:
34+
uses: ./.github/workflows/build.yml

operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/dependent/workflow/WorkflowReconcileExecutorTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import org.assertj.core.api.Assertions;
77
import org.junit.jupiter.api.BeforeEach;
88
import org.junit.jupiter.api.Test;
9+
import org.junit.jupiter.api.TestInfo;
10+
import org.slf4j.Logger;
11+
import org.slf4j.LoggerFactory;
912

1013
import io.fabric8.kubernetes.api.model.ConfigMap;
1114
import io.fabric8.kubernetes.api.model.HasMetadata;
@@ -20,6 +23,7 @@
2023
import static org.mockito.Mockito.*;
2124

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

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

3135
@BeforeEach
3236
@SuppressWarnings("unchecked")
33-
void setup() {
37+
void setup(TestInfo testInfo) {
38+
log.debug("==> Starting test {}", testInfo.getDisplayName());
3439
when(mockContext.getWorkflowExecutorService()).thenReturn(executorService);
3540
when(mockContext.eventSourceRetriever()).thenReturn(mock(EventSourceRetriever.class));
3641
}

operator-framework/pom.xml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@
5757
<artifactId>compile-testing</artifactId>
5858
<scope>test</scope>
5959
</dependency>
60-
<dependency>
61-
<groupId>io.fabric8</groupId>
62-
<artifactId>crd-generator-apt</artifactId>
63-
<scope>test</scope>
64-
</dependency>
6560
<!-- This is just here to make some special test using Route, Openshift is actually not used in tests -->
6661
<dependency>
6762
<groupId>io.fabric8</groupId>
@@ -113,7 +108,10 @@
113108
</execution>
114109
</executions>
115110
</plugin>
111+
<plugin>
112+
<groupId>org.apache.maven.plugins</groupId>
113+
<artifactId>maven-surefire-plugin</artifactId>
114+
</plugin>
116115
</plugins>
117116
</build>
118-
119117
</project>

pom.xml

Lines changed: 111 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@
255255
<groupId>org.apache.maven.plugins</groupId>
256256
<artifactId>maven-compiler-plugin</artifactId>
257257
<version>${maven-compiler-plugin.version}</version>
258+
<configuration>
259+
<compilerArgs>
260+
<arg>-Aio.fabric8.crd.generator.parallel=true</arg>
261+
</compilerArgs>
262+
</configuration>
258263
</plugin>
259264
<plugin>
260265
<groupId>org.apache.maven.plugins</groupId>
@@ -275,6 +280,23 @@
275280
<groupId>org.apache.maven.plugins</groupId>
276281
<artifactId>maven-surefire-plugin</artifactId>
277282
<version>${maven-surefire-plugin.version}</version>
283+
<!-- Summary output for tests at the end -->
284+
<configuration>
285+
<reportFormat>plain</reportFormat>
286+
<consoleOutputReporter>
287+
<disable>true</disable>
288+
</consoleOutputReporter>
289+
<statelessTestsetInfoReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter">
290+
<theme>UNICODE</theme>
291+
</statelessTestsetInfoReporter>
292+
</configuration>
293+
<dependencies>
294+
<dependency>
295+
<groupId>me.fabriciorby</groupId>
296+
<artifactId>maven-surefire-junit5-tree-reporter</artifactId>
297+
<version>1.3.0</version>
298+
</dependency>
299+
</dependencies>
278300
</plugin>
279301
<plugin>
280302
<groupId>org.apache.maven.plugins</groupId>
@@ -349,33 +371,103 @@
349371
</build>
350372
<profiles>
351373
<profile>
352-
<id>all-tests</id>
374+
<id>integration-tests</id>
375+
<dependencies>
376+
<dependency>
377+
<groupId>io.fabric8</groupId>
378+
<artifactId>crd-generator-apt</artifactId>
379+
<scope>test</scope>
380+
</dependency>
381+
</dependencies>
353382
<build>
354383
<plugins>
355384
<plugin>
356385
<groupId>org.apache.maven.plugins</groupId>
357386
<artifactId>maven-surefire-plugin</artifactId>
358387
<configuration>
359388
<includes>
360-
<include>**/*Test.java</include>
361389
<include>**/*IT.java</include>
362-
<include>**/*E2E.java</include>
363390
</includes>
391+
<excludes>
392+
<exclude>**/*Test.java</exclude>
393+
<exclude>**/*E2E.java</exclude>
394+
</excludes>
364395
</configuration>
365396
</plugin>
366397
</plugins>
367398
</build>
368399
</profile>
369400
<profile>
370-
<id>no-unit-tests</id>
401+
<id>integration-tests-baseapi</id>
402+
<dependencies>
403+
<dependency>
404+
<groupId>io.fabric8</groupId>
405+
<artifactId>crd-generator-apt</artifactId>
406+
<scope>test</scope>
407+
</dependency>
408+
</dependencies>
371409
<build>
372410
<plugins>
373411
<plugin>
374412
<groupId>org.apache.maven.plugins</groupId>
375413
<artifactId>maven-surefire-plugin</artifactId>
376414
<configuration>
377415
<includes>
378-
<include>**/*IT.java</include>
416+
<include>io/javaoperatorsdk/operator/baseapi/**/*IT.java</include>
417+
</includes>
418+
<excludes>
419+
<exclude>**/*Test.java</exclude>
420+
<exclude>**/*E2E.java</exclude>
421+
</excludes>
422+
</configuration>
423+
</plugin>
424+
</plugins>
425+
</build>
426+
</profile>
427+
<profile>
428+
<id>integration-tests-dependent</id>
429+
<dependencies>
430+
<dependency>
431+
<groupId>io.fabric8</groupId>
432+
<artifactId>crd-generator-apt</artifactId>
433+
<scope>test</scope>
434+
</dependency>
435+
</dependencies>
436+
<build>
437+
<plugins>
438+
<plugin>
439+
<groupId>org.apache.maven.plugins</groupId>
440+
<artifactId>maven-surefire-plugin</artifactId>
441+
<configuration>
442+
<includes>
443+
<include>io/javaoperatorsdk/operator/dependent/**/*IT.java</include>
444+
</includes>
445+
<excludes>
446+
<exclude>**/*Test.java</exclude>
447+
<exclude>**/*E2E.java</exclude>
448+
</excludes>
449+
</configuration>
450+
</plugin>
451+
</plugins>
452+
</build>
453+
</profile>
454+
<profile>
455+
<id>integration-tests-workflow</id>
456+
<dependencies>
457+
<dependency>
458+
<groupId>io.fabric8</groupId>
459+
<artifactId>crd-generator-apt</artifactId>
460+
<scope>test</scope>
461+
</dependency>
462+
</dependencies>
463+
<build>
464+
<plugins>
465+
<plugin>
466+
<groupId>org.apache.maven.plugins</groupId>
467+
<artifactId>maven-surefire-plugin</artifactId>
468+
<configuration>
469+
<includes>
470+
<include>io/javaoperatorsdk/operator/workflow/**/*IT.java</include>
379471
</includes>
380472
<excludes>
381473
<exclude>**/*Test.java</exclude>
@@ -389,6 +481,13 @@
389481
<!-- Special category of tests. See usage in source code. -->
390482
<profile>
391483
<id>minimal-watch-timeout-dependent-it</id>
484+
<dependencies>
485+
<dependency>
486+
<groupId>io.fabric8</groupId>
487+
<artifactId>crd-generator-apt</artifactId>
488+
<scope>test</scope>
489+
</dependency>
490+
</dependencies>
392491
<build>
393492
<plugins>
394493
<plugin>
@@ -410,6 +509,13 @@
410509
</profile>
411510
<profile>
412511
<id>end-to-end-tests</id>
512+
<dependencies>
513+
<dependency>
514+
<groupId>io.fabric8</groupId>
515+
<artifactId>crd-generator-apt</artifactId>
516+
<scope>test</scope>
517+
</dependency>
518+
</dependencies>
413519
<build>
414520
<plugins>
415521
<plugin>

0 commit comments

Comments
 (0)