Skip to content

build: use matrix for split unit tests#12127

Open
chingor13 wants to merge 6 commits intomainfrom
split-tests
Open

build: use matrix for split unit tests#12127
chingor13 wants to merge 6 commits intomainfrom
split-tests

Conversation

@chingor13
Copy link
Contributor

@chingor13 chingor13 commented Mar 20, 2026

Uses a GitHub actions matrix and the dorny/paths-filter action (already in use) to conditionally run split unit tests for a select number of modules.

When running the bulk unit test suite, we enable use the bulkTests profile. This profile is configured to skip the tests for the ones that have split tests.

@gemini-code-assist
Copy link
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@chingor13 chingor13 marked this pull request as ready for review March 20, 2026 22:17
@chingor13 chingor13 requested review from a team as code owners March 20, 2026 22:17
@chingor13 chingor13 changed the title build: try matrix for split unit tests build: use matrix for split unit tests Mar 20, 2026
@meltsufin
Copy link
Member

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to skip unit tests for specific modules during bulk builds by using a Maven profile bulkTests. The changes in .kokoro/build.sh activate this profile when a full build is performed, and the changes in the various pom.xml files define this profile to set <skipTests>true</skipTests>. The overall approach is sound. I have a suggestion to improve the robustness of the shell script by using an array for the optional Maven profile argument, which is a best practice in bash scripting to avoid potential issues with word splitting.

Comment on lines +46 to +48
EXTRA_PROFILE_OPT=""
else
EXTRA_PROFILE_OPT="-PbulkTests"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To handle optional arguments more robustly in bash, it's better to use an array. This avoids potential word-splitting issues. This converts EXTRA_PROFILE_OPT to an array EXTRA_PROFILE_OPTS; a corresponding change will be needed where it's used (see my other comment).

Suggested change
EXTRA_PROFILE_OPT=""
else
EXTRA_PROFILE_OPT="-PbulkTests"
EXTRA_PROFILE_OPTS=()
else
EXTRA_PROFILE_OPTS=("-PbulkTests")

-Danimal.sniffer.skip=true \
-Dmaven.wagon.http.retryHandler.count=5 \
-T 1C ${SUREFIRE_JVM_OPT}
-T 1C ${SUREFIRE_JVM_OPT} ${EXTRA_PROFILE_OPT}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To correctly expand the EXTRA_PROFILE_OPTS array, use "${EXTRA_PROFILE_OPTS[@]}". This syntax safely handles both empty and non-empty arrays, preventing issues with word splitting and ensuring arguments are passed correctly.

Suggested change
-T 1C ${SUREFIRE_JVM_OPT} ${EXTRA_PROFILE_OPT}
-T 1C ${SUREFIRE_JVM_OPT} "${EXTRA_PROFILE_OPTS[@]}"

strategy:
fail-fast: false
matrix:
java: [11, 17, 21, 25]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about Java 8?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants