Repository navigation
ginkgo: report through gorp.Session - #54
Draft
DzmitryHumianiuk wants to merge 18 commits into
Draft
DzmitryHumianiuk wants to merge 18 commits into
DzmitryHumianiuk wants to merge 18 commits into
Conversation
The replace directive broke go install ...@latest.
Address review feedback on #15: - Stable testCaseId, codeRef and uniqueId so History and retries work - Real timestamps for By() steps, logs and attachments - Per-step status instead of the spec's final status - Send GinkgoWriter and stdout output to ReportPortal - Finish Describe/Context containers explicitly with the right status - Report BeforeSuite/AfterSuite failures as their own items - Env-var configuration, launch attributes, description and mode, and Ginkgo labels as item attributes - Fix temp-file leaks and per-worker cleanup - Suite discovery follows Ginkgo (any *_test.go calling RunSpecs, paths outside cwd), and a worker whose package was not registered logs an ERROR - Never kill the test process from library code - Skip only the agent's own rpagent package instead of any path containing the word - Mark suites that received no specs as skipped, not failed - Tests for container cache locking (including across processes) and hierarchy building
The Ginkgo wrapper stops a launch it cannot finish in two steps, each with its own share of the time: the open items, then the launch. With Abort alone a suite finish that hangs or gets a 5xx used up the budget or ended the abort, and the launch stayed In Progress. AbortItems is the first step of Abort; the owner sends the launch finish itself. Abort behaves as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The agent and the wrapper had their own reporting machinery: synchronous requests with a retry loop (which replayed log batches, so a batch that was stored but not answered was stored up to three times), a pending-log batch per spec, a failure streak in the wrapper and a hand-written stop. They now report through gorp.Session. Workers attach to the wrapper's launch (AttachLaunch) and start specs, By() steps and fixture items through the session; suites and containers started elsewhere are handles (Launch.Item). The lock-file winner waits for its container start (Item.Wait) before publishing the UUID. Every ReportAfterEach ends with a bounded Flush, because in a parallel run only process 1 gets to ReportAfterSuite, which closes the session. The wrapper starts the launch and the suites with its own session, queues the container and suite finishes and finishes the launch with Launch.Finish. When the launch is not finished (deadline, signal, the breaker after three transient failures in a row, a failed launch finish) it stops it as before: suites with AbortItems in two thirds of stopLaunchTimeout, then the launch in the last third. Starts and finishes of workers are retried by the client (WithRetry, 3 attempts, 200 ms); logs are never sent twice. Names and uniqueIds are shortened by the session; testCaseId uses gorp.BoundedID, which gives the same result as the removed boundedID for ASCII IDs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings the session review fixes (bounded log wait in Abort, Finish and Abort serialized, ErrSessionClosed after Abort, trip accounting) and the AbortItems of feat/session. pkg/gorp, README.md, AGENTS.md and SKILL.md now equal feat/session: the conflicts in pkg/gorp/session.go, session_test.go and AGENTS.md were resolved in favour of feat/session, whose AbortItems replaces the one of 7377b08. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the merge of feat/session, Launch.Finish after (or during) an abort sends nothing and returns ErrSessionClosed, not ErrLaunchNotFinished. FinalizeLaunch took any error that did not match ErrLaunchNotFinished for a finished launch and printed SUCCESS; it now goes by the answer of Finish: no answer means this call did not finish the launch, and the error matches ErrLaunchNotFinished (with ErrSessionClosed after an abort), so the wrapper stops the launch. The wrapper's abort already treats the AbortItems error as a warning and always sends the STOPPED launch finish itself, with the client and its own third of stopLaunchTimeout; its comment now says why (AbortItems says nothing about the launch, may report logs not sent after its 2 s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings the round-2 session fixes: Abort/AbortItems try every open item and give up after the breaker threshold of failures in a row, ctx bounds the waits between Finish and Abort, Flush fails when what it waited for was dropped, an unreadable attachment loses only its log, same-named attachments go in separate requests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y the retry budget - A container start is waited for as long as one request with its retries takes (requestBudget: 3 attempts x the HTTP timeout + 2 pauses of at most 10 s, 110 s), not one HTTP timeout. When the wait still ends first, TestListener.StartShared keeps the item as pending under its cache key: this process reports under it (its session sends the children after it, the spec results bring it to the wrapper, which finishes it), and the next spec waits for it again instead of starting a second "Describe X" that nobody finished. The UUID is published to other workers only once the start was answered. - flushReports is bounded by the same budget: the last Flush of a worker that is not the first gave up after one hung attempt, and the process exited with the retries unsent. - NewReportingClient sets httpTimeout on the client; the client of WithApiKeyAuth always had gorp's 30 s, so the setting never applied. - The wrapper's abort: AbortItems now tries every suite after a transient failure (gorp round-2 semantics); doc and a test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 #27. Refs #52.
#52 says L6 merges only together with a second consumer of
gorp.Session. This is that consumer: the Ginkgo agent from #15 now reports through the session.This PR is based on
feat/session(the L6 PR). It also stacks on #15: head 923718e is merged in as 0f6fafa. Until #15 is merged, the diff againstfeat/sessionshows #15 as well. Review the commits on top of 0f6fafa:Add Launch.AbortItems: abort without the launch finish(pkg/gorp). Superseded:AbortItemsnow lives onfeat/session(9aca770), and the merge 12b984b takespkg/gorpfrom there.ginkgo: report through gorp.Session(pkg/ginkgo)Merge feat/session into feat/session-ginkgo(the L6 review fixes andAbortItems)ginkgo: follow the session's abort rules(pkg/ginkgo)Merge feat/session into feat/session-ginkgo(round 2 of the L6 review: 8da3e4d)ginkgo: reuse a container start that outlived its wait; bound waits by the retry budget(pkg/ginkgo)pkg/ginkgodoes not build on its own yet.pkg/ginkgo/go.modstill requires the released goRP v5.2.2, which has noSession. It needs a goRP release that includes L6, then a bump of the require. Until then the module builds only through a workspace (task ginkgo:workspace, orGOWORKpointing to a go.work with.and./pkg/ginkgo). The require is left alone on purpose.For the same reason these fail on this branch, locally and in
.github/workflows/build.yml:task ginkgo:build,ginkgo:vetandginkgo:test, so roottask testtoo;task ginkgo:lint(Docker);Only the CI step
task ginkgo:workspacecan pass. See Open questions for the merge order.The areas that #15 round 5 asked its author to change (
cmd/ginkgo-rp/proc_unix.goand the job-control tests) are not touched.Changes
Merge of
feat/session(12b984b)pkg/gorp/session.go,pkg/gorp/session_test.goandAGENTS.md(7377b08 against the L6 review fixes), resolved in favour offeat/session. After the mergegit diff feat/session -- pkg/gorp README.md AGENTS.md .claude internal e2eis empty: the only differences fromfeat/sessionare Add Ginkgo v2 agent and ginkgo-rp wrapper (pkg/ginkgo) #15 andpkg/ginkgo.Launch.AbortItemsis documented in the L6 PR:Abortwithout the launch finish, sameendMu, drop, 2 s log wait; a laterFinishreturnsErrSessionClosed; its error never matchesErrLaunchNotFinished.Adapting to the session's rules (3548ead)
rpagent.FinalizeLaunch(launch_coordinator.go) took anyFinisherror that did not matchErrLaunchNotFinishedfor success and printed SUCCESS. After the merge,Finishafter or during an abort returnsErrSessionClosedand sends nothing. It now goes by the answer:rs == nilmeans this call did not finish the launch. The error then matchesErrLaunchNotFinished(plusErrSessionClosedafter an abort), and the wrapper stops the launch. A non-nilrswith item errors is still success. New case inTestFinalizeLaunchClosesTheLaunchAndPrintsTheServersLink:AbortItems, thenFinalizeLaunchreturnsErrLaunchNotFinished+ErrSessionClosed, sends no finish and prints no SUCCESS. It fails on 12b984b (err=<nil>, "SUCCESS: launch L1 finalized").rpLaunch.abort(cmd/ginkgo-rp/main.go) needed no code change, only a comment. It prints theAbortItemserror as a warning and always sends the STOPPED launch finish itself, with the client and its own third ofstopLaunchTimeout. It never tests forErrLaunchNotFinished, so "N logs were not sent" fromAbortItemscan't be taken for a finished launch.StartLaunch/AttachLaunchreturningErrSessionClosed: neither session can be closed while those calls run. The wrapper callsStartLaunch(main.go,initLaunch) before anything can close it.NewTestListener(test_listener.go:79) attaches before the listener is returned. A failed attach leavestl.launchnil, andStart,finishItem,QueueLogandSendAttachmentLogall check for nil first.Item.Wait→ErrBreakerOpen/ErrSessionClosed: both callers (main.gosuite creation,StartAndWait) handle any error.finishSuitesFromResults).Finishdrains it without the limit; only an abort after a failed finalization can cut it.Round 2 of the review (8055c7e, fff248d)
feat/session8da3e4d. No conflicts.Abort/AbortItemsnow try every open item after a transient failure and give up after the breaker threshold of failures in a row (3) or when ctx ends; ctx bounds the wait betweenFinishandAbort;Flushfails when what it waited for was dropped; an unreadable attachment loses only its log; same-named attachments go in separate requests. See the L6 PR.ProcessSpecWithHierarchyAndReturnIDsusedStartAndWaitwithhttpTimeout(30 s), the same as one HTTP attempt. A first attempt that timed out ended the wait while retries 2 and 3 were still to come:GetOrCreategot "", the spec fell back to the suite, and the next spec under the same container started a second "Describe X". The first one, stored by a retry, was in no spec status, so the wrapper never finished it.containerStartWait = requestBudget(): 3 attempts ×httpTimeout+ 2 ×MaxWait(10 s, a Retry-After may ask for it) = 110 s.workerRetryPolicyspells outMaxWait(gorp's default) for that.TestListener.StartShared(key, wait, item): when the wait ends first it returns "" (soGetOrCreatepublishes nothing and other workers get no UUID the server may not have yet) but keeps the item as pending under the cache key, on the listener (not package state).PendingShared(key)gives it to the caller, which reports the spec under it: this process's session sends the children after the container, and the spec status carries the UUID to the wrapper, which finishes the container with the results. The next spec'sStartSharedfor that key waits for the pending item again instead of starting a new one, and publishes it once it is answered.GetOrCreateremoves its lock file whencreateFuncreturns, so while the container is pending another worker process can take the lock and start its own "Describe X" (its losers still wait 10 s first). Reworking the lock protocol is out of scope.flushReportswas bounded by 30 s = one HTTP attempt. A worker that is not process 1 exits after its last spec'sReportAfterEach, so a request whose first attempt hung lost its retries and everything queued behind it. The bound is nowrequestBudget()(110 s). It applies per hook, i.e. per spec; the total stall before the breaker opens is at most 3 such requests (each failing all attempts), as before, because the session kept sending in the background anyway.httpTimeoutnever applied.NewReportingClientset it only when the client's timeout was 0, but the client ofgorp.WithApiKeyAuthalways has gorp's 30 s. Same value, so no behaviour change; it is set unconditionally now (and is a variable, so tests can shorten it).pkg/ginkgo/README.md: the per-spec wait is "up to 110 s, one request with all its retries" (was 30 s).rpLaunch.abortkeeps its 2/3 + 1/3 budget and its own STOPPED launch finish. With the newAbortItemsa 503 on one suite no longer leaves the other suites open. The wrapper client has no retries, so a hanging server costs at most the 20 s items budget (one 30 s attempt is cut by ctx), and 3 fast 5xx in a row stop the suites; the launch finish is tried in either case. Comment updated.TestHierarchyReusesAContainerStartThatOutlivedItsWait(container_cache_test.go; 100 ms wait, first start answered after 300 ms: one stored "Describe X", both specs under it; a third spec after the answer publishes the UUID to the cache file, which a fresh process then reads without starting it again; before: started twice),TestFlushReportsWaitsForTheRetriesOfAHungRequest(flush_budget_test.go;httpTimeout100 ms, first attempt hangs, the retry is answered: stored afterflushReports; with the old bound,reportFlushTimeout = httpTimeout, nothing was stored, 1 attempt),TestAbortTriesEverySuiteAfterATransientFailure(cmd/ginkgo-rp/main_test.go, ported from the reviewer:suite-c:503, suite-b:200, suite-a:200, launch:STOPPED; on 3548ead'spkg/gorpit fails).pkg/ginkgo/rpagent: workersTestListenernow only builds requests. It holds a session attached to the wrapper's launch (AttachLaunch, no I/O ininit()) and keeps a UUID →*gorp.Itemmap of the items this process started. Any other ID is reported to as a handle (Launch.Item): the wrapper's suite, a container another worker created, orspec-itemin tests.Startreturns the client UUID at once.rp_cache_*only after the start was answered. Since round 2 this isStartShared(wait bounded by the 110 s retry budget, pending reuse; see Round 2); before,StartAndWaitbounded by the 30 s HTTP timeout.GetOrCreateand the cache files are unchanged.FinishTest/FinishTestNotIssue,QueueLogandSendAttachmentLogqueue into the session.FlushandClose.isRetriableErrorandretry(3 attempts with sleeps; this loop replayed log batches);pendingqueue,QueueLog's own batching,FlushLogs,maxBatchLogs/maxBatchBytesand per-log UUIDs;SendLog;FinishSuiteandSendLaunchLog, which no code called. A worker must not finish a wrapper-owned suite anyway;limits.go(boundedName,boundedID,utf16Len) and its test. Names and uniqueIds are now shortened by the session, andtestCaseIdusesgorp.BoundedID(id, gorp.MaxTestCaseIDLength);globalClient, and the unusedclientparameter ofProcessSpecWithHierarchyAndReturnIDs.gorp.WithRetry(RetryPolicy{MaxRetries: 2, MinWait: 200ms}). Starts and finishes get 3 attempts, as before. Logs are sent once.ReportAfterEachends withFlush(30 s bound).ReportAfterSuitecallsClose(same bound) afterfinishOpenHierarchiesand beforeCleanupAttachmentsand the done flag. The design (§7.2) put onlyCloseinReportAfterSuite. That is not enough: in a parallel run only one process runsReportAfterSuite(Investigation log 4).gorp.ReaderMultipartnamed after the original file. Its reader (stagedFile) opens the temp copy when the session sends the log, and closes and removes it at the end.FinalizeLaunch(ctx, launch, forceFailed)takes the wrapper's*gorp.Launchand callsLaunch.Finish.ErrLaunchNotFinished, shortened toErrBreakerOpenwhen the breaker opened).NewReportingClient(endpoint, project, apiKey, debug, opts ...gorp.Option): the new variadicoptsare passed through.pkg/ginkgo/cmd/ginkgo-rp: the wrappercreateRPLaunchAndSaveStatereturns an*rpLaunch(client,*gorp.Launch, suite items by directory) instead of the launch ID and the suite cache.Session.StartLaunch, so the UUID is the one in the response.Item.Wait) before it goes into the suite cache.rl.abort, asstopLaunchdid before.finishSuitesFromResultsandfinishContainersonly queue now:launch.Item(c.ID).Finishfor containers, andsuite.Log/suite.Finishfor suites. They no longer return errors, read the state and config files again or build a client.rpLaunch.abort(ctx)replacesabortLaunchandstopLaunch. It runsAbortItemswithin 2/3 ofstopLaunchTimeout, thenclient.FinishLaunch(STOPPED)within the last 1/3. Failures are printed as warnings.failureStreak,maxConsecutiveFinishFailures,errReportPortalNotResponding,abortLaunchandstopLaunch. The 3-in-a-row rule is now the session breaker.AbortItemsand thenFinishLaunch(STOPPED)itself, notAbort. That is a deviation from design §7.2; Investigation log 3 explains why.WARNING: …when it happens, which matches the old per-item warnings. The wrapper's client still has noWithRetry. Its calls are single attempts, as before, and as the attempt-count assertions require.Tests
uuid, as ReportPortal does:fakeRP(e2e_test.go),flowServerandechoID.step-1,id-1), a smallaliaseshelper maps the client UUIDs back to those names in start order (outputHarness,TestFinishSpecHierarchyUsesGinkgoTimeline,recordingRP). The assertions themselves are unchanged.TestIsRetriableError,TestFlushLogsBatchesAndSplitsBySize,TestFailureStreak*andTestFinishContainersStopsWhenCancelled: the session's own tests cover this behaviour.TestStartTest{Retries…,DoesNotRetry…}becameTestWorker{RetriesServerErrorWithSameUUID,DoesNotRetryClientError}, throughworkerRetry.TestWorkerNeverSendsALogTwice: a log batch that gets a 503 is sent once.TestSendAttachmentLogOpensTheFileOnlyToSendIt: with the breaker open, 5 attachments leave their files unread. AstagedFileis opened only byRead, then closed and removed at EOF.TestFinishContainersGivesUpAfterConsecutiveFailuresnow checks that the session breaker stops after 3 requests out of 20.TestFinalizeLaunch…now uses a launch started by a session.TestFinishSuiteAndLaunchLog,TestSendAttachmentLogUploadRejectedKeepsMessage(see Behaviour change) andlimits_test.go.TestHierarchySurvivesContainerStartFailurenow asserts that the spec falls back under the suite. A spec item always has a UUID now, so the old check (StepIDempty) no longer applies.cmd/ginkgo-rp/e2e_test.go, real ginkgo againstfakeRP) are unchanged except for the uuid echo. That includes the round 4/5 guarantees:TestWrapperFinalizeFailureKeepsGinkgoExitCode:[PASSED STOPPED], and exit 2 in strict mode;TestWrapperGivesUpOnItemsAfterThreeFailuresInARow:level3, level2, level1, Fixture Suiteand launch[STOPPED];TestWrapperKeepsFinishingItemsWhenTheyAreRejected: a 4xx doesn't count;TestWrapperAbortFinishesSuitesThenLaunchAsStopped;Behaviour change
retryaroundSaveLogs/SaveLogMultipart). Logs are now sent once. Starts and finishes are still retried, with the same client UUID.ReportAfterEach(bounded by one request's retry budget, 110 s; 30 s before round 2). Before, it waited for every request. Logs are no longer guaranteed to arrive before the item finish; the server accepts logs for a finished item.By()step whose start fails no longer falls back: its logs used to be re-routed to the parent. The session now skips its logs, finish and children and logsErrNotStartedas a warning. A failed start is not known when the hook runs.ErrNotStarted, logged); before, they fell back to the suite.ReaderMultipartis unknown to the batcher'sMaxBytes. With the default 10 MB attachment limit, one request carries at most 100 MB, under the server's 128 MB.gorp.Truncate, which, likeboundedName, counts UTF-16 units and ends in....testCaseIdusesgorp.BoundedID, which equals the oldboundedIDfor ASCII IDs:TestOverLongIdentityKeepsUniqueIDOfTheFullIDstill gets exactly 1024 characters ending in~c7fca14d35e62afd. For non-ASCII IDs over the limit the cut differs:boundedIDcounted bytes,BoundedIDcounts UTF-16 units. Add Ginkgo v2 agent and ginkgo-rp wrapper (pkg/ginkgo) #15 is unreleased, so no history depends on the old form.TruncateAttributes, to 128 characters per key and value.Verification
All
pkg/ginkgocommands run through a temporary workspace:go work init <l6g> <l6g>/pkg/ginkgoin a scratch directory, withGOWORKpointing to it. No go.work is committed.cd pkg/ginkgo && go build ./... && go vet ./... && GOOS=windows go vet ./... && go vet -tags sanity ./examples/...: OK.go test -race -count=1 -cover ./...inpkg/ginkgo:cmd/ginkgo-rp(includes the wrapper e2e tests, 46.7 s)rpagentgo test -race -count=3 ./rpagent/also passes.Root module (
GOWORK=off go test -race -count=1 ./...): OK.go test -race -count=5 -run TestSession_ ./pkg/gorp/: OK.Lint, golangci-lint v2.15.0:
run --build-tags e2e ./...: 0 issues;pkg/ginkgorun ./...(whattask ginkgo:lintruns, here withGOWORK): 0 issues.--build-tags sanityreports 5 issues inexamples/(misspell, SA4000). They come from Add Ginkgo v2 agent and ginkgo-rp wrapper (pkg/ginkgo) #15 and are not touched here.Live, local ReportPortal 6.0.0 (docker-compose
gorp-local, not demo). Fixtures were copied fromscratchpad/livetoscratchpad/live-l6g, with replaces to this branch'spkg/ginkgoand root. The baseline used the same copy pointed atpr15-wt(923718e) and a wrapper built from it.ginkgo-rp -r --keep-going.ginkgo-rp -r -p --procs=3 --keep-going --skip-package=slow.scratchpad/l6g-tools/rptree.py(each item's path, type, status, hasStats, retries, issue and log count) and diffed: they are identical except for the launch name.text/plain; charset=utf-8in the baseline and in both migrated runs.PATH=<go bin>:/usr/bin:/bin ginkgo-rp-l6 -r --keep-going, so there is noginkgoon the PATH. The output shows "ginkgo not found", exit 1. All 3 suites ended STOPPED and the launch STOPPED (not FAILED); nothing is In Progress. This runsAbortItemsplus the directFinishLaunchagainst the real server.ginkgo-rp ./slow, with SIGINT to the wrapper after 20 s, run with the baseline and the migrated binary.WARNINGlines appeared in any run.gorp-wave-l6g-*) were deleted afterwards. Afilter.cnt.name=gorp-wave-l6gquery returns none.After the merge of
feat/session(3548ead)Root:
go build ./... && go vet ./... && go vet -tags e2e ./e2e/OK;go test -race -count=1 ./...OK;go test -race -count=20 ./pkg/gorp/ ./internal/commands/OK; golangci-lint v2.15.0run --build-tags e2e ./...: 0 issues.pkg/ginkgo(temporary workspace):go build ./...,go vet ./...,go vet -tags sanity ./examples/...,GOOS=windows go vet ./...OK;go test -race -count=1 -cover ./...:cmd/ginkgo-rpok 90.1%,rpagentok 87.5%; golangci-lint v2.15.0run ./...(withGOWORK): 0 issues. The--- FAIL: TestFixturelines in-voutput come from the fixture subprocesses, not from the suite.The round 4/5 guarantees still hold (all pass): launch never left In Progress (
TestWrapperAbortFinishesSuitesThenLaunchAsStopped,TestWrapperRunsTestsWhenReportPortalIsDown); 4xx is not an outage (TestWrapperKeepsFinishingItemsWhenTheyAreRejected);TestWrapperFinalizeFailureKeepsGinkgoExitCodeasserts[PASSED STOPPED], also in strict mode; three failures in a row (TestWrapperGivesUpOnItemsAfterThreeFailuresInARow); finalize deadline (TestWrapperGivesUpFinalizingAfterTheDeadline); signal during finalization (TestWrapperSignalDuringFinalizationStopsTheLaunch,TestWrapperSecondSignalDuringFinalizationGivesUpAtOnce).e2e of the root module on the local ReportPortal: 21 passed (62.2 s).
Live Ginkgo comparison, repeated on the local ReportPortal 6.0.0 with
scratchpad/bin/ginkgo-rp-l6rebuilt from 3548ead (workspace build,vcs.revision=3548ead) and the baseline binary of 923718e. Tools:scratchpad/l6g-tools/run.sh,rptree.py. The trees are identical item by item, apart from the launch name:ginkgoon PATH), migrated./slow, baseline / migratedIn the Ctrl-C runs, "is interrupted" and its By step are INTERRUPTED in both, "never runs" is SKIPPED, and the trees are identical. No
WARNINGlines appeared in any run. The 7gorp-wave-l6g2-*launches were deleted. The e2e suite leaves one…-TestLaunchListAndMerge-mergedlaunch per run (ids 387 and 408). The server answers 500 to the DELETE of a merged launch, and the older leftovers on the server are the same kind.Round 2 (fff248d)
Root (
GOWORK=off):go build ./... && go vet ./... && go vet -tags e2e ./e2e/OK;go test -race -count=1 ./...OK;go test -race -count=20 ./pkg/gorp/ ./internal/commands/OK; golangci-lint v2.15.0run --build-tags e2e ./...: 0 issues.pkg/ginkgo(temporary workspace):go build ./...,go vet ./...,GOOS=windows go vet ./...,go vet -tags sanity ./examples/...OK;go test -race -count=1 -cover ./...:cmd/ginkgo-rpok 90.1%,rpagentok 88.0%;go test -race -count=3 ./rpagent/OK; golangci-lint v2.15.0run ./...: 0 issues.Pre-existing, not fixed (from Add Ginkgo v2 agent and ginkgo-rp wrapper (pkg/ginkgo) #15, 923718e):
go test -count=2 -run TestCleanupRemovesExactlyOneSessionsFiles ./cmd/ginkgo-rp/fails atmain_test.go:450("the test must create files for both sessions, got 8 and 8"), because the process-wideinMemoryContainerCachesurvives the first iteration.-count=1passes.Round 4/5 guarantees: all wrapper tests pass unchanged (
TestWrapperAbortFinishesSuitesThenLaunchAsStopped,…RunsTestsWhenReportPortalIsDown,…KeepsFinishingItemsWhenTheyAreRejected,…FinalizeFailureKeepsGinkgoExitCode,…GivesUpOnItemsAfterThreeFailuresInARow,…GivesUpFinalizingAfterTheDeadline,…SignalDuringFinalizationStopsTheLaunch,…SecondSignalDuringFinalizationGivesUpAtOnce).e2e of the root module on the local ReportPortal 6.0.0: 22 passed (58.9 s, at 8055c7e/fff248d).
Live Ginkgo comparison on the local ReportPortal 6.0.0,
scratchpad/bin/ginkgo-rp-l6rebuilt from fff248d (vcs.revision=fff248d; the migrated runs were repeated after the lastLogBatcherchange, with the same result; the baseline runs are from the first pass), baselineginkgo-rp-base(923718e), fixturesscratchpad/live-l6g/scratchpad/live-base,scratchpad/l6g-tools/run.sh+rptree.py, logs and trees inscratchpad/live-r6/. Trees identical item by item (diffof the dumps without the launch line is empty):ginkgoon PATH), migratedNo
WARNINGline in any run. The 8gorp-wave-l6g3-*/gorp-wave-l6g4-*launches were deleted. The e2e runs left…-TestLaunchListAndMerge-mergedlaunches (438, 463, 485, 512, 537): the server answers 500TransientObjectExceptionto the DELETE of a merged launch, like the older leftovers.Investigation log
Baseline. At 0f6fafa (workspace),
go test -race -count=1 -cover ./...inpkg/ginkgogave ok with 89.2% and 88.4%. The live baseline above matches the task's numbers (19 / TI 4 and 16 / TI 4).Where the agent reported. The requests were in:
rpagent/test_listener.go(923718e):retryaround every call, includingSaveLogsinFlushLogsandSaveLogMultipart. A retried batch is a new POST, and the server has no key for logs, so this is the "log replay ×3".cmd/ginkgo-rp/main.go:failureStreak,abortLaunchandstopLaunch.FinalizeLaunch, which built its own client from the state and config files.Abortalone could not keep the wrapper's guarantees.Launch.Abort(pkg/gorp/session.go, before 7377b08) stops at the first transient item failure, before the launch finish, and uses one ctx. In the wrapper's session the suites are in the open set. Traced againstcmd/ginkgo-rp/e2e_test.go:TestWrapperGivesUpOnItemsAfterThreeFailuresInARow(:448): the breaker opens on level3/2/1.Abortthen gets a 500 on "Fixture Suite" and returns, but the test wants launch[STOPPED].TestWrapperGivesUpFinalizingAfterTheDeadline(:931) and…SignalDuringFinalizationStopsTheLaunch(:953): the hanging suite finish uses upAbort's whole ctx, sostopAttempts()stays 0. The oldstopLaunchkept 1/3 of the time for the launch.TestWrapperFinalizeFailureKeepsGinkgoExitCode(:419) wants exactly[PASSED STOPPED]. An extra directFinishLaunchafter every failedAbortwould make 3 attempts.Both
Abortoutcomes matchErrLaunchNotFinished, so the wrapper can't tell them apart. ChangingAbortwould break L6's "Abort against a dead server sends one request" (session_test.go:320). Decision: addAbortItems, and have the wrapper send the launch finish itself in the reserved third (rpLaunch.abort,main.go:481). All four tests pass unchanged.Flush per spec. Ginkgo v2.26.0
reporting_dsl.go:165says: "When running in parallel, Ginkgo ensures that only one of the parallel nodes runs the ReportAfterSuite". The agent's own comment atrpagent/attachment.go:49says the same. So aSession.Closeonly inReportAfterSuite(design §7.2) would drain process 1 only, and the other processes would exit with their queue unsent. Decision: a boundedFlushat the end ofReportAfterEach(reporting_node.go:208). This answers design open question 6. The parallel live run (3 procs) shows the same 38 items and 31 logs as the baseline.Shared containers. The winner must not publish a UUID whose start isn't answered, because the losers would report children under it at once. So
StartAndWaitis used inGetOrCreate'screateFunc(ginkgo_helpers.go:67), bounded byhttpTimeout. Losers still wait up toRP_LOCK_RETRY_COUNT × SLEEP(10 s) as before.The wrapper client stays without
WithRetry. The old wrapper sent single attempts, and the attempt-count assertions (finalizeAttempts,launchFinishAttempts) depend on that. Only the worker clients getworkerRetry(reporting_node.go:273), which matches the old workerretry(3, 200ms)for starts and finishes.boundedID→gorp.BoundedID. Same separator (~), same 16 hex digits of SHA-256, same 1024 limit (pkg/gorp/limits.goBoundedID, removedrpagent/limits.go). For ASCII the cut is identical:TestOverLongIdentityKeepsUniqueIDOfTheFullID(identity_test.go) asserts exactly 1024 characters ending in~c7fca14d35e62afd, and it passes unchanged.Attachments.
FileMultipart.Loadnames the part after the temp file (rp-attachment-*.txt), but the e2e test wantsevidence.txt. So it is aReaderMultipartwith the original name.stagedFile(test_listener.go) opens it at the firstReadand closes and removes it at EOF, so a dropped log never holds a file descriptor (found in review: the first version opened the file up front and leaked it when the log was dropped).logSize(pkg/gorp/log_batcher.go), so only the 10-entry limit bounds a request (Behaviour change).Fakes. The session ignores the
idof an item start and uses the client UUID (L6 Investigation log 5). The fakes that answered with their own IDs were changed to echouuid, or to map it throughaliases. Assertions were changed only where they compared against the fake's IDs.Errors in the wrapper.
Launch.Finishcan return a non-nilrsand an error together: the session reports item errors such as 4xx on containers and still finishes the launch.FinalizeLaunchtreats that as success, because the handler already printed each error. OnlyErrLaunchNotFinishedleads toabortand to exit 2 in strict mode (TestWrapperKeepsFinishingItemsWhenTheyAreRejected,e2e_test.go:1197).Merge with the L6 review fixes.
Launch.Finishafter or duringAbort/AbortItemsnow returnsErrSessionClosedinstead ofErrLaunchNotFinished(pkg/gorp/session.go,Finish,case aborted).FinalizeLaunchtested only forErrLaunchNotFinished, so this would have printed SUCCESS for a launch it did not finish. It was fixed to go byrs == nil, and the new test case proves the old code wrong. The wrapper never callsFinishafter its own abort, but the check no longer depends on that order.B3. Reviewer's
TestReview_StartAndWaitTimeoutOrphansTheContainer, ported asTestHierarchyReusesAContainerStartThatOutlivedItsWaitthroughProcessSpecWithHierarchyAndReturnIDs(the reviewer calledGetOrCreatedirectly). On 0cf6414 + the injectable wait: "Describe X started 2 times". Both waits end before the 300 ms answer, so the test asserts one stored start and both specs under it, not that the second call returns the UUID from the cache. Who finishes the container: the wrapper (AggregateContainers,containers.go), from theContainerIDsof the spec statuses; so the pending UUID must reach the spec status, whichPendingShareddoes. The pending state lives on theTestListener, not in the package-levelinMemoryContainerCache(the cause of the-count≥2failure above).Retry budget.
gorp.WithRetryconfigures Resty's retry (pkg/gorp/retry.goconfigureResty), which callshttp.Client.Doper attempt, soTimeoutis per attempt. Pauses:MinWaitdoubling up toMaxWait, a Retry-After up toMaxWait. Hence attempts × timeout + retries ×MaxWait. While writing the flush test the client turned out to ignorehttpTimeout:oauth2.NewClientcopies the base client'sTimeout, andgetClient(pkg/gorp/client.go) gives 30 s, soc.Timeout == 0was never true. The first version of the test passed for the wrong reason (the hung handler returned an empty 200 after 1 s); with the timeout set it fails on the old bound and passes on the new one.Final Flush.
flushReports(reporting_node.go) serves everyReportAfterEach(Flush) andReportAfterSuite(Close); only process 1 runsReportAfterSuitein a parallel run (Investigation 4). So the lastReportAfterEachof processes 2…n is their final send. A 30 s bound equal to one attempt let one hung attempt use it up.Wrapper and B2. The wrapper client is built without
WithRetry(main.go:726), unlike the workers (reporting_node.go:104-110). Reviewer'sTestReview_AbortStopsAtFirstSuiteFailurelogged[item:suite-c:503 launch:STOPPED]; ported with assertions asTestAbortTriesEverySuiteAfterATransientFailure, it fails with 3548ead'spkg/gorp(checked bygit checkout 3548ead -- pkg/gorp, then restored) and passes after the merge.Not verified
task ginkgo:test/ginkgo:lint, which use Docker and no workspace. They need a goRP release withSession.fakeRP(real ginkgo processes) and the session's unit tests. The abort before the run (noginkgo) was checked live.Flushwould actually lose reports. This rests on the Ginkgo documentation; the change was not reverted to check.TestWorkerNeverSendsALogTwicecovers the new behaviour.GOOS=windows go vet ./...was run.stagedFileopens the attachment at its firstRead, which is afterMultipart.Load; if it fails then, the whole log batch still fails (the batcher separates onlyLoaderrors).go mod tidy -diffinpkg/ginkgo: it can't resolve without a goRP release that hasSession. No dependency was added;rpagentno longer importsgithub.com/google/uuid, but the wrapper still does.Open questions
pkg/ginkgocan't build standalone, and its CI steps stay red, until a goRP release contains L6. Options:pkg/ginkgoCI steps until the release.Flushat the end of every spec instead of onlyCloseinReportAfterSuite(design §7.2 and its open question 6). It is required for parallel runs, but it puts a wait back intoReportAfterEach: one per spec, not one per request.WithLogBatching(MaxEntries: …)? A larger batch makes the unknown size of attachments matter.AbortItemsas a public API (now in the L6 PR), versus an option onAbortor a typed error that tells the ownerAbortstopped before the launch finish.🤖 Generated with Claude Code