Skip to content

Test infrastructure: JUnit 5, game tests and CI - #82

Merged
dshadowwolf merged 1 commit into
master-2.0-1.21.1-neofrom
test-infra
Nov 2, 2026
Merged

dshadowwolf merged 1 commit into
master-2.0-1.21.1-neofrom
test-infra

Conversation

@faceofcat

Copy link
Copy Markdown
Collaborator

What this is

Second PR of the machine module stack, after #81. This one only touches tests, build scripts and CI. Nothing under src/main changes.

Unit tests. src/test is now JUnit 5 on the standard test task, with no running game.

  • The MachineCoreTest main program is split into ExprTest, MachineStatsTest, InternalsDefinitionTest, MachinePartsTest, AmountMatchTest and InputClaimsTest, with one behaviour per test.
  • One run now reports every failure, instead of stopping at the first.

Server game tests. ./gradlew runGameTestServer replaces the opt-in server smoke run.

  • MMDLibGameTests runs each check as its own @GameTest in an empty structure.
  • The run loads main and runtimeTest as one mod, in a fresh build/gametest world each time, and the task fails naming every failed test.
  • The checks in RuntimeSmoke moved to ContentSmoke.
  • The machine part files moved from src/runtimeTest/datapack to src/runtimeTest/resources, so they're now served as mod data rather than copied into a world as a datapack.
  • scripts/runtime-smoke.init.gradle is gone.

Build.

  • check now runs test and runGameTestServer.
  • verifyReleaseClasses also fails if test data (data/mmdlib_smoke/, data/mmdlib/structure/) reaches the release jar.

CI. .github/workflows/ci.yml is new. It runs on every pull request and on pushes to this branch:

  • ./gradlew check
  • The client GUI smoke test under Xvfb, with and without JEI.

Review notes

  • One commit, rebased onto the merged Machine module stage 1: internals and recipe core #81.
  • The review fixes from Machine module stage 1: internals and recipe core #81 added checks to MachineCoreTest, which this PR deletes. They're all ported: malformed variable names to ExprTest, socketAt bounds to InternalsDefinitionTest, unknown keys and MachineParts.check to MachinePartsTest, and input claims to the new InputClaimsTest.
  • The other src/builderTest programs stay as they are here, still run by their verify* tasks. Moving them to JUnit is a separate follow-up (junit-builder-checks).
  • machine-recipes (registered recipe types and generic JEI) is stacked on this branch and gets its own PR after this lands.

Testing

  • ./gradlew check passes locally: 52 unit tests with no failures, and all 12 game tests.
  • I didn't run the GUI smoke test locally after the rebase, so the CI job on this PR is what covers it.

🤖 Generated with Claude Code

https://claude.ai/code/session_018zpP6ZrFjaGe477FvWAZKo

- src/test: JUnit 5 on the standard test task. The machine core checks move
  from the MachineCoreTest main program into ExprTest, MachineStatsTest,
  InternalsDefinitionTest, MachinePartsTest, AmountMatchTest and
  InputClaimsTest, one behaviour per test, so a run reports every failure.
- Server game tests replace the server-start smoke run: MMDLibGameTests runs
  each check as its own @gameTest in an empty structure. runGameTestServer
  loads main and runtimeTest as one mod in a fresh build/gametest world and
  fails naming every failed test. The checks from RuntimeSmoke are split into
  ContentSmoke; the machine part files are now test resources.
- verifyReleaseClasses also refuses test data in the release jar.
- check runs test and runGameTestServer. CI runs check and the GUI smoke
  test (with and without JEI) under Xvfb on every pull request.
- scripts/runtime-smoke.init.gradle is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018zpP6ZrFjaGe477FvWAZKo
@dshadowwolf

Copy link
Copy Markdown
Collaborator

Okay, some notes, but nothing is a blocker to me merging:

  1. Testing being in the main build path instead of a ./gradlew check (or similar) separate task is going to make things notably slower
  2. The release-jar guard is overly broad -- this might break things if MMDLib ever ships with a structure.
  3. blocksPlace and bucketsPlaceAndRecover still use absolute world coordinates, not test-relative ones. The crackhammer test was converted to helper.absolutePos; these two weren't.
  4. CI Action versions -- I have been unable to verify the versions, but will accept that they likely exist.
  5. Stale docs (not from this PR series) in reference to the to-be-removed vanilla extensions. Lets keep an eye on things just-in-case though.

@dshadowwolf
dshadowwolf merged commit df58ef0 into master-2.0-1.21.1-neo Nov 2, 2026
3 checks passed
@faceofcat
faceofcat deleted the test-infra branch November 2, 2026 16:47
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.

2 participants