Skip to content

Add batch test-run REST endpoint - #1701

Merged
ashishvijaywargiya merged 15 commits into
apache:trunkfrom
ashishvijaywargiya:test-run-api-batch-support
Aug 23, 2026
Merged

Add batch test-run REST endpoint#1701
ashishvijaywargiya merged 15 commits into
apache:trunkfrom
ashishvijaywargiya:test-run-api-batch-support

Conversation

@ashishvijaywargiya

Copy link
Copy Markdown
Contributor

Adds a batch endpoint on top of the existing test-run REST API in framework/testtools, fanning a
full-suite run out to multiple components in one call, tracked under one batchId:

POST /rest/testtools/testruns/batch
GET /rest/testtools/testruns/batch/{batchId}

With no components list, every component that has a testdef and has the test execution API
enabled is queued automatically. With an explicit components list, an empty list is rejected
outright, and every named component must itself be known, have a testdef, and be enabled, or the
whole call is rejected up front naming which entries were invalid - no batch is ever queued from
an invalid or empty list. A component that passes this upfront check but still fails its actual
test run (e.g. a testdef that resolves to zero tests) is omitted from the batch rather than
failing the whole call, the same way an auto-discovered component would be. Each queued component
always runs its whole suite through the existing runTestSuite service, called as a plain Java
method, not through the service engine, so the batch stays serialized on the same single-threaded
executor runTestSuite already uses - no new concurrency anywhere in this change.

getBatchTestRunStatus polls a batch's aggregate status (QUEUED/RUNNING/PASSED/FAILED/ERROR,
rolled up from its children's own tracked statuses) plus each component's own runId/status/
resultSummary, reusing the same response shape GET testruns/{runId} already returns for that
runId.

No change to the existing single-component runTestSuite/getTestRunStatus contract, except one
additive field: getTestRunStatus's response now also includes runId alongside the existing
status/componentName/resultSummary.

Testing

  • Unit tests for BatchRunTracker, BatchRunServices, and the extended TestRunServices: all
    passing, including status-rollup precedence (a batch with one ERROR and one FAILED child rolls
    up to ERROR, not FAILED, etc.), duplicate-component-list dedup, and rejecting a batch where
    every requested component's runTestSuite call fails outright rather than silently reporting
    PASSED with zero children.
  • Full testIntegration run: all suites passing, zero regressions.
  • Manual verification against a running server: auto-discovery batch across every enabled
    component, explicit-list batch, both 422 edge cases (an unknown component in an explicit list;
    the test execution API disabled globally), and the existing single-component endpoint's
    unaffected behavior plus the additive runId field.

- Add test for ERROR taking precedence over FAILED
- Add test for FAILED taking precedence over RUNNING
- Add test for genuinely QUEUED child never marked running
Task 2 added a runId field to describeRun()'s response shape, but
getTestRunStatus's service definition still declared runId as IN-only,
so the service engine silently dropped it from the actual REST
response. Live verification caught the gap. Change runId to
mode="INOUT" so it's both the polling key and part of the response,
matching what describeRun already returns and what the batch
endpoint's per-component entries (which reuse describeRun) already
include.
@ashishvijaywargiya
ashishvijaywargiya merged commit 39fb3d0 into apache:trunk Aug 23, 2026
7 checks passed
@jacopoc

jacopoc commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Hi @ashishvijaywargiya

Could you please have a look at the following warning message generated by the code at line 330 of the TestRunServicesTest class? Thanks!

@ashishvijaywargiya

Copy link
Copy Markdown
Contributor Author

Thank you @jacopoc for letting me know about this.

I just fixed the warning in the below PR:

#1801

@ashishvijaywargiya
ashishvijaywargiya deleted the test-run-api-batch-support branch August 29, 2026 06:54
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