← Back to Pull requests

Smoke test the administrator APIs against each database #570

Closed
unknown closed this pull request without merging on Nov 14, 2026 19:05 UTC
View on GitHub
unknown unknown commented on Nov 10, 2026 07:55 UTC
Author

Most of the SQL behind the Administrator's screens doesn't run in any automated test. The CI fixtures under ci/tests/ deploy channels and send messages, and the server's tests of these controllers use mocks. The older database-backed tests (DataPrunerTests and others) are Derby-only and excluded from the build. A change to a SQL map or the database layer, such as the MyBatis and HikariCP upgrade in #545, could break user management, the event or message browser, or the pruner on one database without CI noticing.

This PR adds smoke tests that drive those APIs through the client against the server and database under test, so they run on all seven CI configurations.

Commits

1. Put the engine's jars first on the harness classpath. run-harness.sh sorted every jar alphabetically, so the stock jersey-proxy-client-2.22.1.jar came before mirth-client-core.jar and mirth-server.jar, which carry the engine's own WebResourceFactory with multipart support. Every multipart call from a harness test failed with "MessageBodyWriter not found … multipart/form-data", so no smoke test could, for example, save channel groups. The engine's mirth-.jar now go first. This also lets the engine's override of a jTDS class take effect in the harness.
2. Add a retrying assertion helper to the smoke test harness. Harness.awaitAsserted runs a check every 500 ms until it passes or the harness timeout passes. awaitAssertedValue does the same for a check that returns the value it verified:
- An AssertionError means "not yet", so the check runs again. On timeout, a new AssertionError is thrown whose message starts with "Timed out after Ns:" followed by the last failure's message, so it says it timed out and still describes what the check saw.
- A check throws FinalAssertionError for a failure that waiting can't fix. Any other exception, such as a lost connection, is thrown at once.
- The value overload has its own name because a lambda that returns a value, such as () -> count == 0, would otherwise select it silently and pass without checking anything.
- OieServer.awaitStarted and Harness.runMessage now use it. runMessage still stops as soon as every message is terminal. A few failure messages change wording, mainly so that timeouts say they timed out. The commit message lists them, and nothing in ci/ or smoketest/ parses them.
3. Smoke test the administrator APIs against each database. The tests go in a new package, org.openintegrationengine.smoketest.admin, next to the generated cases package, rather than among the harness classes. SharedServer, OieServer and the members the tests call are now public. A new Harness.newChannel loads a channel fixture with a random ID and a name that includes it, so tests never collide with each other or with a channel left by an earlier run. The tests use awaitAsserted and awaitAssertedValue wherever they wait on the server. The test classes are:
- UserAccountTest: create, update and remove a user; set, replace and read preferences; a failed login, then a successful one, then the last-login time.
- ChannelGroupTest, CodeTemplateLibraryTest, AlertTest, GlobalScriptsTest, ServerSettingsTest and ConfigurationMapTest: save and reload a channel group, a code template library and template, an alert, the global scripts, a server setting and the configuration map, removing or restoring each afterwards.
- EventBrowserTest: search audit events by name and attribute, and page through them.
- MessageBrowserTest: search messages by content text, metadata column, custom metadata and attachment; page; reprocess; remove.
- DataPrunerTest: run the pruner on a channel with pruning settings and check the event it records.
- DebugUsageTest: deploy with the debugger enabled and check the usage row that is reported, then deleted.
4. Remove legacy tests the smoke tests duplicate. DonkeyEngineControllerTests and Donkey's MessageControllerTests are never run by the build, and the smoke tests now cover what they check. DataPrunerTests and the server's MessageControllerTests stay, because nothing here prunes messages or runs reprocessing and searches concurrently.

A follow-up PR will move the existing hand-written tests (DatabaseMetadataTest, CommandLineInterfaceTest and WebServiceListenerTest) into packages of their own, and update the smoke test README to match.

Limits

  • The configuration map is stored in a file by default, so its test covers the servlet, not SQL.

  • The pruner test's messages are too new to prune, so it covers the selection queries and the event, not the delete statements.

  • Text searches use the stored case, because Oracle's search is case-sensitive and Derby's and PostgreSQL's aren't. So the tests don't check case-insensitive search on those databases.
  • Every test leaves the server as it found it, so the tests can run in any order, or twice against the same server. The pruner test prunes every channel with pruning settings, so don't run it against a server whose data matters.

    Testing

  • ./gradlew clean build passes.

  • All smoke tests pass on all seven CI configurations, against server images built from this branch: 42 on Alpine with PostgreSQL, MySQL, Oracle and SQL Server and on Ubuntu with PostgreSQL, and 39 on Alpine and Ubuntu with Derby.
  • Two agent reviews checked the commits, and the first also checked for overlap with existing tests. The only overlap is incidental: the shared admin login, the channel deploys that read code templates and global scripts, and Harness.fetchMessage looking up messages by ID. None of the writes, searches, paging, reprocessing, pruning or usage statistics were tested before.

    ---
    Drafted with Claude Code*

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: pacmano1 Review duration: 6430m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #570"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%