mirror of
https://github.com/floci-io/floci.git
synced 2026-11-29 00:21:51 -05:00
ci: verify the source-derived shard class list against compiled test classes (#4245)
all-classes.txt is derived from src/test/java file names so shard.txt exists before Compile. A test class whose name differed from its file would drop out of both all-classes.txt and the shard union, and the completeness check in CI summary would not notice. After Compile, derive the list from target/test-classes as before and fail the shard if the two disagree.
This commit is contained in:
1 parent
b18ddc2c24
commit
288cc01268
1 file changed
+18
-1
@@ -74,7 +74,8 @@ jobs:
|
||||
# Derived from test sources, not target/test-classes, so shard.txt exists
|
||||
# before Compile and the image prefetch below overlaps the compile instead
|
||||
# of starting moments before the tests that need the images. Every test is
|
||||
# a top-level class in src/test/java, so the file name is the class name.
|
||||
# a top-level class in src/test/java, so the file name is the class name;
|
||||
# the step after Compile fails the shard if that ever stops being true.
|
||||
- name: Compute shard include list
|
||||
run: |
|
||||
cd src/test/java
|
||||
@@ -95,6 +96,22 @@ jobs:
|
||||
- name: Compile
|
||||
run: ./mvnw test-compile -B
|
||||
|
||||
# all-classes.txt is derived from file names, so a test class whose name
|
||||
# differs from its file would drop out of both it and the shard union
|
||||
# without the completeness check noticing. The compiled classes are the
|
||||
# ground truth; fail here if the two lists ever disagree.
|
||||
- name: Verify shard list matches compiled test classes
|
||||
run: |
|
||||
cd target/test-classes
|
||||
find . \( -name '*Test.class' -o -name 'Test*.class' \
|
||||
-o -name '*Tests.class' -o -name '*TestCase.class' \) \
|
||||
! -name '*$*' \
|
||||
| sed 's|^\./||; s|\.class$||' | LC_ALL=C sort \
|
||||
> "$RUNNER_TEMP/compiled-classes.txt"
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
cmp -s all-classes.txt "$RUNNER_TEMP/compiled-classes.txt" \
|
||||
|| { echo "::error::test class list from src/test/java differs from target/test-classes:"; diff all-classes.txt "$RUNNER_TEMP/compiled-classes.txt" | head -50; exit 1; }
|
||||
|
||||
- name: Run tests
|
||||
run: >
|
||||
./mvnw surefire:test -B
|
||||
|
||||
Reference in new issue
Block a user