Skip to content

Commit d38423f

Browse files
committed
feat(ci): split integration tests execution by category (#2548)
* feat(build): split ITs by category, parallel CRD generation Also avoid generating CRDs when not needed by default, summarizes test results. * chore(deps): bump actions-setup-minikube to 2.13.0 * feat: default to use vertx client * chore(ci): reduce tested combinations, only run client tests on baseapi * fix: increase deletion timeout --------- Signed-off-by: Chris Laprun <[email protected]>
1 parent 6b4de40 commit d38423f

File tree

8 files changed

+194
-96
lines changed

8 files changed

+194
-96
lines changed

Diff for: .github/workflows/build.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
http_client_tests:
23+
strategy:
24+
matrix:
25+
java: [ 17, 21 ]
26+
kubernetes: [ 'v1.28.14', 'v1.29.9','1.30.5', '1.31.1' ]
27+
it-category: [ 'baseapi' ]
28+
httpclient: [ 'vertx', 'jdk', 'jetty' ]
29+
uses: ./.github/workflows/integration-tests.yml
30+
with:
31+
java-version: ${{ matrix.java }}
32+
kube-version: ${{ matrix.kubernetes }}
33+
it-category: ${{ matrix.it-category }}
34+
http-client: ${{ matrix.httpclient }}
35+
36+
special_integration_tests:
37+
runs-on: ubuntu-latest
38+
strategy:
39+
matrix:
40+
java: [ 17, 21 ]
41+
steps:
42+
- uses: actions/checkout@v4
43+
- name: Set up Java and Maven
44+
uses: actions/setup-java@v4
45+
with:
46+
distribution: temurin
47+
java-version: ${{ matrix.java }}
48+
- name: Run Special Integration Tests
49+
run: ./mvnw ${MAVEN_ARGS} -B package -P minimal-watch-timeout-dependent-it --file pom.xml

Diff for: .github/workflows/fabric8-next-version-schedule.yml

+2-40
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

Diff for: .github/workflows/integration-tests.yml

+17-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
http-client:
1313
type: string
1414
required: false
15-
default: 'jdk'
15+
default: 'vertx'
1616
experimental:
1717
type: boolean
1818
required: false
@@ -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/[email protected]
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} -T1C -B install -DskipTests -Pno-apt --file pom.xml
62+
./mvnw ${MAVEN_ARGS} -T1C -B package -P${it_profile} -Dfabric8-httpclient-impl.name=${{inputs.http-client}} --file pom.xml

Diff for: .github/workflows/pr.yml

+3-37
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

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

+6-2
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 = spy(Context.class);
@@ -30,8 +34,8 @@ class WorkflowReconcileExecutorTest extends AbstractWorkflowExecutorTest {
3034

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

Diff for: operator-framework/pom.xml

+4-6
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>

Diff for: operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/clusterscopedresource/ClusterScopedResourceIT.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
1010
import io.javaoperatorsdk.operator.junit.LocallyRunOperatorExtension;
1111

12+
import static io.javaoperatorsdk.operator.IntegrationTestConstants.GARBAGE_COLLECTION_TIMEOUT_SECONDS;
1213
import static org.assertj.core.api.Assertions.assertThat;
1314
import static org.awaitility.Awaitility.await;
1415

@@ -46,7 +47,7 @@ void crudOperationOnClusterScopedCustomResource() {
4647
});
4748

4849
operator.delete(resource);
49-
await().atMost(Duration.ofSeconds(30))
50+
await().atMost(Duration.ofSeconds(GARBAGE_COLLECTION_TIMEOUT_SECONDS))
5051
.untilAsserted(() -> assertThat(operator.get(ConfigMap.class, TEST_NAME)).isNull());
5152
}
5253

0 commit comments

Comments
 (0)