Skip to content

report test2json: add --description, --mode, --rerun and --rerun-of - #42

Open
DzmitryHumianiuk wants to merge 1 commit into
fix/test2json-reportingfrom
feat/test2json-launch-options
Open

DzmitryHumianiuk wants to merge 1 commit into
fix/test2json-reportingfrom
feat/test2json-launch-options

Conversation

@DzmitryHumianiuk

Copy link
Copy Markdown
Member

Summary

Part of #26 (slice C2). Stacked on #29 (fix/test2json-reporting); merge that first.

report test2json could only set the launch name and attributes. This adds the remaining launch options of
the start request: description, mode and rerun.

Changes

  • --description (LAUNCH_DESCRIPTION): launch description.
  • --mode (LAUNCH_MODE, default DEFAULT): DEFAULT or DEBUG, case-insensitive. Any other value fails
    with exit code 1 before the input is read or anything is sent.
  • --rerun (LAUNCH_RERUN): sends rerun=true, so the server reports into the latest launch with the same name.
  • --rerun-of <uuid> (LAUNCH_RERUN_OF): sends rerun=true and rerunOf. It implies --rerun, because the
    server ignores rerunOf when rerun is not set.
  • The reporter keeps using the launch id of the start response for items, logs, finish, --print-launch-uuid
    and --quality-gate-check; it never uses the --rerun-of value itself. A comment and a test pin this.
  • README and the reportportal skill: flag tables, environment variables, a paragraph on reruns.

Behaviour change

None for existing invocations: the new flags are optional and the mode default is still DEFAULT.

Verification

  • go build ./... && go vet ./... && go test -race ./...: ok.
  • go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.15.0 run ./...: 0 issues.
  • New unit tests: TestReportLaunch_LaunchOptions (request fields for defaults, description + debug, --rerun,
    --rerun-of; items carry the launch id of the response) and TestReportLaunch_InvalidModeFailsBeforeReporting.
  • Live, ReportPortal 6.0.0 (demo), launch gorp-wave-c2-172939, deleted afterwards:
    1. First run with --description "wave c2 check" --mode debug: the launch has description, mode=DEBUG,
      rerun=false, status FAILED, executions total 1, failed 1.
    2. --rerun with the same name: the command printed the UUID of the first launch.
    3. --rerun-of <uuid> with a different --launchName: the same UUID again. The launch then had rerun=true,
      status PASSED, executions total 2, passed 2, and its name was unchanged. No second launch was created.
    4. --rerun with a name that has no launch: the server answers 404 {"errorCode":4041,…} and gorp exits 1.
    5. --mode nope: invalid --mode "nope": expected DEFAULT or DEBUG, exit 1, nothing sent.

Investigation log

  1. Request fields exist in the generated model, so no schema change is needed:
    grep -n "json:" pkg/openapi/model_com_epam_reportportal_base_reporting_start_launch_rq.go shows
    description, mode, rerun, rerunOf.
  2. Which UUID a rerun returns: service-api develop,
    src/main/java/com/epam/reportportal/base/reporting/async/producer/LaunchStartProducer.java:58-60:
    if (request.isRerun()) request.setUuid(rerunHandler.getRerunLaunchUuid(rerunOf, name, projectId)).
    So rerunOf without rerun does nothing, which is why --rerun-of implies --rerun.
  3. How the launch to rerun is found:
    core/launch/rerun/RerunHandlerImpl.java:112-124 (getRerunLaunchUuid): by rerunOf UUID within the project,
    otherwise the latest launch with that name; no match throws LAUNCH_NOT_FOUND (404 / 4041). Mode is not part of
    the lookup.
  4. The reporter already took the launch id from the response (reporter.go, startLaunch → entryID), so
    "always use the id from the response" needed no code change, only a test and a comment.
  5. The "5.13.5 and later" limit for the returned UUID is taken from
    scratchpad/consilium2/server.md (row "Rerun") and was not re-checked at older tags.
  6. Live run: scratchpad/wave/live-c2.sh, output in scratchpad/wave/live/c2.log.

Not verified

  • Servers older than 6.0.0, in particular what a v2 rerun returns before 5.13.5.
  • Overlap with slice C1 (atomic commands), which also validates --mode for start-launch in another branch.
    The helper here is named test2jsonLaunchMode to avoid a clash; once both are merged they can share one.

🤖 Generated with Claude Code

--mode accepts DEFAULT or DEBUG (case-insensitive) and is validated before
anything is read or sent. --rerun reports into the latest launch with the
same name, --rerun-of into the named launch (and implies --rerun). The
launch id of the server's response is used for everything that follows:
for a rerun it is the UUID of the original launch (ReportPortal 5.13.5+).

Part of #26.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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