Skip to content

Commit ddded87

Browse files
authored
[MINOR UPDATE] Shard CI tests and raise the surefire fork count (#3079)
1 parent 12b33de commit ddded87

2 files changed

Lines changed: 47 additions & 12 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ on: [push, pull_request]
2727

2828
jobs:
2929
build:
30-
name: Main Build
30+
name: Main Build (java ${{ matrix.java }}, shard ${{ matrix.shard }})
3131
runs-on: ubuntu-latest
3232
if: github.repository == 'apache/drill'
3333
timeout-minutes: 150
@@ -36,6 +36,12 @@ jobs:
3636
# Java versions to run unit tests (Jetty 12 requires Java 17+)
3737
java: [ '17', '21', '25' ]
3838
profile: ['default-hadoop']
39+
# exec/java-exec holds ~31 minutes of the suite in 577 classes, which dominates
40+
# the build. Splitting it three ways by class name brings the longest shard to
41+
# about 11 minutes. Boundaries were chosen from measured per-class times; the
42+
# patterns are exhaustive, so a newly added test always lands in exactly one
43+
# shard rather than being silently skipped.
44+
shard: [ '1', '2', '3' ]
3945
fail-fast: false
4046
steps:
4147
- name: Checkout
@@ -50,24 +56,53 @@ jobs:
5056
# Linux Action Runners come with 7GB of RAM which isn't quite enoough
5157
# to run the test suite. Two workarounds are used below: a swap file is
5258
# added to the Runner and memory hungry tests are run separately.
59+
# dd rather than fallocate: swapon rejects fallocated files on some runner
60+
# filesystems ("Invalid argument"). A missing swap file only costs headroom,
61+
# so warn instead of failing the job.
5362
run: |
5463
sudo sh -c "
55-
fallocate -l 2G /tmp/swapfile
56-
chmod 0600 /tmp/swapfile
57-
mkswap /tmp/swapfile
58-
swapon /tmp/swapfile
59-
"
64+
dd if=/dev/zero of=/drill-swapfile bs=1M count=2048 status=none &&
65+
chmod 0600 /drill-swapfile &&
66+
mkswap /drill-swapfile &&
67+
swapon /drill-swapfile
68+
" || echo "::warning::Could not add swap space; continuing without it"
69+
# Which slice of the suite this job runs. The patterns are spelled out one prefix
70+
# at a time because surefire does NOT support character-class globs:
71+
# -Dtest='Test[A-F]*' silently matches nothing and the build passes green having
72+
# run no tests. Only '*' wildcards and comma separated lists work, so each letter
73+
# gets its own entry, in both cases (TestforBaseTestInheritance has a lowercase f).
74+
#
75+
# Shard 3 repeats surefire's other default includes (*Test, *Tests, *TestCase) to
76+
# pick up classes not named Test*. Verified exhaustive against every test
77+
# class in the repo. TestFrameworkTest matches shards 1 and 3 and runs twice —
78+
# harmless, and far safer than a gap that skips tests without saying so.
79+
- name: Select test shard
80+
id: shard
81+
run: |
82+
case "${{ matrix.shard }}" in
83+
1) echo 'pattern=TestA*,Testa*,TestB*,Testb*,TestC*,Testc*,TestD*,Testd*,TestE*,Teste*,TestF*,Testf*' >> "$GITHUB_OUTPUT" ;;
84+
2) echo 'pattern=TestG*,Testg*,TestH*,Testh*,TestI*,Testi*,TestJ*,Testj*,TestK*,Testk*,TestL*,Testl*,TestM*,Testm*,TestN*,Testn*,TestO*,Testo*,TestP*,Testp*' >> "$GITHUB_OUTPUT" ;;
85+
3) echo 'pattern=TestQ*,Testq*,TestR*,Testr*,TestS*,Tests*,TestT*,Testt*,TestU*,Testu*,TestV*,Testv*,TestW*,Testw*,TestX*,Testx*,TestY*,Testy*,TestZ*,Testz*,*Test,*Tests,*TestCase,Test0*,Test1*,Test2*,Test3*,Test4*,Test5*,Test6*,Test7*,Test8*,Test9*,Test_*' >> "$GITHUB_OUTPUT" ;;
86+
*) echo "::error::Unknown shard '${{ matrix.shard }}'; expected 1, 2 or 3"; exit 1 ;;
87+
esac
88+
89+
# -DforkCount=2: several of the slowest classes are wall-clock bound rather than
90+
# CPU bound — TestTimedCallable spends 105 seconds asleep, and the RPC, SSL and
91+
# graceful-shutdown tests wait on timeouts — so a second fork overlaps that idle
92+
# time at little extra cost. Raise further only with memory headroom: the vector
93+
# tests fail with OutOfMemoryException under pressure.
6094
- name: Build and test
6195
run: |
6296
mvn -P${{ matrix.profile }} install --batch-mode --no-transfer-progress \
97+
-DforkCount=2 \
98+
-Dsurefire.failIfNoSpecifiedTests=false \
99+
-Dtest='${{ steps.shard.outputs.pattern }}' \
63100
-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
64101
- name: Remove swap space
65102
run : |
66-
sudo sh -c "
67-
free -h
68-
swapoff /tmp/swapfile
69-
rm /tmp/swapfile
70-
"
103+
free -h
104+
sudo swapoff /drill-swapfile 2>/dev/null || true
105+
sudo rm -f /drill-swapfile
71106
checkstyle_protobuf:
72107
name: Run checkstyle and generate protobufs
73108
runs-on: ubuntu-22.04

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
<surefire.version>3.1.2</surefire.version>
148148
<swagger.version>2.2.42</swagger.version>
149149
<target.gen.source.path>${project.basedir}/target/generated-sources</target.gen.source.path>
150-
<testcontainers.version>1.20.0</testcontainers.version>
150+
<testcontainers.version>1.21.4</testcontainers.version>
151151
<typesafe.config.version>1.4.2</typesafe.config.version>
152152
<univocity-parsers.version>2.8.3</univocity-parsers.version>
153153
<wiremock.standalone.version>2.23.2</wiremock.standalone.version>

0 commit comments

Comments
 (0)