Skip to content

Commit 407deaf

Browse files
committed
feat(ci): split integration tests execution by category
Signed-off-by: Chris Laprun <claprun@redhat.com>
1 parent 3dd77c1 commit 407deaf

File tree

6 files changed

+132
-81
lines changed

6 files changed

+132
-81
lines changed

.github/workflows/build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
uses: ./.github/workflows/integration-tests.yml
17+
with:
18+
java-version: ${{ matrix.java }}
19+
kube-version: ${{ matrix.kubernetes }}
20+
it-category: ${{ matrix.it-category }}
21+
22+
httpclient-tests:
23+
strategy:
24+
matrix:
25+
httpclient: [ 'vertx', 'jdk', 'jetty' ]
26+
uses: ./.github/workflows/integration-tests.yml
27+
with:
28+
java-version: 17
29+
kube-version: 'v1.30.5'
30+
http-client: ${{ matrix.httpclient }}
31+
experimental: true
32+
33+
special_integration_tests:
34+
runs-on: ubuntu-latest
35+
strategy:
36+
matrix:
37+
java: [ 17, 21 ]
38+
steps:
39+
- uses: actions/checkout@v4
40+
- name: Set up Java and Maven
41+
uses: actions/setup-java@v4
42+
with:
43+
distribution: temurin
44+
java-version: ${{ matrix.java }}
45+
cache: 'maven'
46+
- name: Run Special Integration Tests
47+
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 & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -27,42 +27,5 @@ jobs:
2727
- name: Run unit tests
2828
run: ./mvnw ${MAVEN_ARGS} clean install --file pom.xml
2929

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
30+
build:
31+
uses: ./.github/workflows/build.yml

.github/workflows/integration-tests.yml

Lines changed: 12 additions & 3 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,14 @@ 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 }}
4953
- 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
54+
run: |
55+
it_profile="integration-tests"
56+
if [ -z "${{inputs.it-category}}" ]; then
57+
it_profile="integration-tests-${{inputs.it-category}}"
58+
fi
59+
./mvnw ${MAVEN_ARGS} -B package -P${it_profile} -Dfabric8-httpclient-impl.name=${{inputs.http-client}} --file pom.xml

.github/workflows/pr.yml

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,5 @@ jobs:
3030
- name: Run unit tests
3131
run: ./mvnw ${MAVEN_ARGS} clean install --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: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.concurrent.Executors;
55

66
import org.assertj.core.api.Assertions;
7+
import org.junit.jupiter.api.AfterEach;
78
import org.junit.jupiter.api.BeforeEach;
89
import org.junit.jupiter.api.Test;
910

@@ -14,12 +15,16 @@
1415
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource;
1516
import io.javaoperatorsdk.operator.processing.event.EventSourceRetriever;
1617
import io.javaoperatorsdk.operator.sample.simple.TestCustomResource;
18+
import org.junit.jupiter.api.TestInfo;
19+
import org.slf4j.Logger;
20+
import org.slf4j.LoggerFactory;
1721

1822
import static io.javaoperatorsdk.operator.processing.dependent.workflow.ExecutionAssert.assertThat;
1923
import static org.junit.jupiter.api.Assertions.*;
2024
import static org.mockito.Mockito.*;
2125

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

2429
@SuppressWarnings("unchecked")
2530
Context<TestCustomResource> mockContext = mock(Context.class);
@@ -30,11 +35,12 @@ class WorkflowReconcileExecutorTest extends AbstractWorkflowExecutorTest {
3035

3136
@BeforeEach
3237
@SuppressWarnings("unchecked")
33-
void setup() {
38+
void setup(TestInfo testInfo) {
39+
log.debug("==> Starting test {}", testInfo.getDisplayName());
3440
when(mockContext.getWorkflowExecutorService()).thenReturn(executorService);
3541
when(mockContext.eventSourceRetriever()).thenReturn(mock(EventSourceRetriever.class));
3642
}
37-
43+
3844
@Test
3945
void reconcileTopLevelResources() {
4046
var workflow = new WorkflowBuilder<TestCustomResource>()

pom.xml

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@
367367
</build>
368368
</profile>
369369
<profile>
370-
<id>no-unit-tests</id>
370+
<id>integration-tests</id>
371371
<build>
372372
<plugins>
373373
<plugin>
@@ -386,6 +386,66 @@
386386
</plugins>
387387
</build>
388388
</profile>
389+
<profile>
390+
<id>integration-tests-baseapi</id>
391+
<build>
392+
<plugins>
393+
<plugin>
394+
<groupId>org.apache.maven.plugins</groupId>
395+
<artifactId>maven-surefire-plugin</artifactId>
396+
<configuration>
397+
<includes>
398+
<include>io/javaoperatorsdk/operator/baseapi/**/*IT.java</include>
399+
</includes>
400+
<excludes>
401+
<exclude>**/*Test.java</exclude>
402+
<exclude>**/*E2E.java</exclude>
403+
</excludes>
404+
</configuration>
405+
</plugin>
406+
</plugins>
407+
</build>
408+
</profile>
409+
<profile>
410+
<id>integration-tests-dependent</id>
411+
<build>
412+
<plugins>
413+
<plugin>
414+
<groupId>org.apache.maven.plugins</groupId>
415+
<artifactId>maven-surefire-plugin</artifactId>
416+
<configuration>
417+
<includes>
418+
<include>io/javaoperatorsdk/operator/dependent/**/*IT.java</include>
419+
</includes>
420+
<excludes>
421+
<exclude>**/*Test.java</exclude>
422+
<exclude>**/*E2E.java</exclude>
423+
</excludes>
424+
</configuration>
425+
</plugin>
426+
</plugins>
427+
</build>
428+
</profile>
429+
<profile>
430+
<id>integration-tests-workflow</id>
431+
<build>
432+
<plugins>
433+
<plugin>
434+
<groupId>org.apache.maven.plugins</groupId>
435+
<artifactId>maven-surefire-plugin</artifactId>
436+
<configuration>
437+
<includes>
438+
<include>io/javaoperatorsdk/operator/workflow/**/*IT.java</include>
439+
</includes>
440+
<excludes>
441+
<exclude>**/*Test.java</exclude>
442+
<exclude>**/*E2E.java</exclude>
443+
</excludes>
444+
</configuration>
445+
</plugin>
446+
</plugins>
447+
</build>
448+
</profile>
389449
<!-- Special category of tests. See usage in source code. -->
390450
<profile>
391451
<id>minimal-watch-timeout-dependent-it</id>

0 commit comments

Comments
 (0)