Repository navigation
report test2json: add --launch-uuid to report into an existing launch - #43
Open
DzmitryHumianiuk wants to merge 2 commits into
Open
DzmitryHumianiuk wants to merge 2 commits into
DzmitryHumianiuk wants to merge 2 commits into
Conversation
With --launch-uuid the results go into a launch that exists already, for
sharded CI. The launch is neither started nor finished, also not when the
command is interrupted: only the items of this reporter are finished.
The reporting API accepts items for an unknown launch UUID and for items
older than their launch, and drops them without telling the client. So
the launch is looked up first (GET /api/v1/{project}/launch/uuid/{uuid},
a 404 is retried for 10 s since launches are created asynchronously), and
the first event must not be older than the launch.
--rerun, --rerun-of and --quality-gate-check are rejected with
--launch-uuid; the flags that describe a launch to start are ignored with
a warning. pkg/gorp gets ReportingClient.GetLaunchByUUID.
Part of #26.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The launch stays open in this test, so nothing guarantees that the server has processed the item finishes when the four items exist. On a local ReportPortal 6.0.0 the FAILED test was still IN_PROGRESS in 5 of 5 runs. finishedItems also waits until no item is IN_PROGRESS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Fix for the e2e test added here, found on a local ReportPortal 6.0.0 (same build as demo,
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #26 (slice C3). Stacked on C2 (
feat/test2json-launch-options), which is stacked on #29.Sharded CI needs several
report test2jsonruns to write into one launch. ReportPortal has no "join" call: anitem only names its
launchUuid, and the asynchronous v2 API accepts whatever it is given. This PR adds--launch-uuidand the two checks that make the missing server feedback visible.Changes
report test2json --launch-uuid <uuid>: report into an existing launch.upload) only the items this reporter started are finished as
INTERRUPTED; the launch is left alone.GET /api/v1/{project}/launch/uuid/{uuid}. A 404 is retried every second for up to 10 s (a launch that wasjust started by
start-launchmay not exist yet); after that the command fails. Any other error fails at once.The 10 s limit applies to the retries only, so a slow answer is not reported as "not found".
Investigation log 3: the server drops such items silently).
IN_PROGRESSgives a warning only.--print-launch-uuid: printsReportPortal Launch UUID: <the given uuid>. No link line, because the linkcomes from the finish response and the launch is not finished here.
--quality-gate-check: rejected (exit 1) before anything is sent. The gate is calculated when the launch isfinished, so the check could only time out. The message names the alternative:
gorp quality-gate check --launch-uuid <uuid>aftergorp report finish-launch.--rerun,--rerun-of: rejected (exit 1).--launchName,--attr,--description,--mode: ignored with a warning when set.--skipped-issue=falsekeeps working: gorp sets "No Defect" on each skipped item itself. Only theskippedIssuelaunch attribute cannot be set.pkg/gorp:ReportingClient.GetLaunchByUUID(ctx, uuid) (*LaunchInfo, error).LaunchInfohasID,UUID,Name,Status,StartTimeand decodesstartTimeboth as epoch milliseconds (what 6.0.0 sends on thisendpoint) and as RFC3339. An unknown UUID is an
*HTTPErrorwith status 404.TestReportTest2JSON_TwoShardsIntoOneLaunch(start-launch, two concurrent shards, finish-launch) andTestReportTest2JSON_UnknownLaunchUUID.Behaviour change
None without
--launch-uuid. The flag has no environment variable on purpose (see Open questions).Verification
go build ./... && go vet ./... && go vet -tags e2e ./e2e/ && go test -race ./...: ok.golangci-lint@v2.15.0 run ./...andrun --build-tags e2e ./e2e/...: 0 issues.internal/commands/report_join_test.go): no launch start/finish requests and the rightlaunchUuidon items; no launch finish on interrupt while items are finishedINTERRUPTED; events older thanthe launch are refused and nothing is sent; flag conflicts are found before any request; 404 is retried and then
fails; a 401 is not retried;
startTimein epoch milliseconds.pkg/gorp:TestGetLaunchByUUID.go test -tags e2e -count=1 -v -run 'Shards|UnknownLaunchUUID' ./e2e/...→PASS TestReportTest2JSON_TwoShardsIntoOneLaunch (4.27s),PASS TestReportTest2JSON_UnknownLaunchUUID (10.02s).The shard test asserts: one launch with that name, still
IN_PROGRESSafter both shards, 4 items (2 suites,2 tests) with the right parents; after
finish-launchwithout--statusthe launch isFAILEDwith executionstotal 2, passed 1, failed 1.
Investigation log
develop(
src/main/java/com/epam/reportportal/base/):core/item/impl/StartTestItemHandlerImpl.java:94,119throwsLAUNCH_NOT_FOUNDonly when the queued message is processed;reporting/async/exception/ReportingErrorHandler.java:50,58,83-98re-queues it up toreporting.retry.max-count(20) times and then sends it to the parking-lot queue. The client already got 201.ws/controller/LaunchController.java:233(GET /uuid/{launchId}). Live:unknown UUID →
404 {"errorCode":4041,"message":"Launch '…' not found. Did you use correct Launch ID?"};known →
{"id":4,"uuid":"…","status":"IN_PROGRESS","startTime":1795818722097,…}.startTimeis epochmilliseconds, which the generated launch model cannot decode, hence the small
LaunchInfotype(same reason as
MergedLaunchinpkg/gorp/launches.go).StartTestItemHandlerImpl.java:193-199checksrq.getStartTime()againstlaunch.getStartTime()(CHILD_START_TIME_EARLIER_THAN_PARENT). Live probe(
scratchpad/wave/probe-c3.sh, logscratchpad/wave/live/c3-probe.log): a suite withstartTime 2026-01-01posted to v2 into a launch started "now" got201 {"id":…}and never appeared in thelaunch; a suite stamped "now" did. This is the usual mistake with saved
go test -jsonfiles (tests run first,launch started afterwards), so the command refuses it instead of reporting nothing. It also bit the first draft
of the e2e test, whose fixtures were stamped 2026-01-01.
start-launchreturned, already answered 200. The retry is kept because creation is queued and the delay depends on server
load; 10 s is a guess, not a measured bound.
201, the item appearedIN_PROGRESS, thelaunch stayed
FAILEDwith its oldendTime. Not an error on the server, so only a warning here.and the error said
context deadline exceededinstead of "not found". The limit is now a timer next to theticker (
findLaunchToJoinininternal/commands/report.go); requests use the caller's context.--quality-gate-check:checkQualityGateInternal(internal/commands/quality_gate.go) polls the launchmetadata until the gate is resolved; for an unfinished launch that is the timeout. Rejecting is cheaper than
waiting a minute for exit code 10.
Open questions
LAUNCH_UUIDenv var. The step commands andquality-gate checkread--launch-uuidfromLAUNCH_UUID.Here the flag has no env source: a pipeline that exports
LAUNCH_UUIDfor step commands and also runsreport test2jsonwould silently change from "new launch" to "join". Adding the env var later is compatible;removing it would not be.
drop those items anyway; the check only makes it visible.
Not verified
developand observed on the6.0.0 demo only).
end to end.
--launch-uuidagainst a real server (unit test only; the non-join interrupt path has an e2etest in report test2json: report tests as STEPs, handle skips, send system attributes #29).
🤖 Generated with Claude Code