Repository navigation
TB-964: fail fast on remote errors, close the tunnel on SIGINT/SIGTERM - #21
Open
jochen-testingbot wants to merge 1 commit into
Open
jochen-testingbot wants to merge 1 commit into
jochen-testingbot wants to merge 1 commit into
Conversation
- Poller: a FAILED (or unknown) run, or a run whose session id starts with 'error' (the grid could not start Cypress), now rejects with the remote error instead of polling until killed. API errors no longer escape the interval as unhandled rejections; five in a row give up. - Tunnel.stop() is idempotent and a no-op without a tunnel (it crashed with "Cannot read properties of undefined (reading 'close')"). - Signal handlers are registered before the tunnel starts, cover SIGTERM, and always close the tunnel and exit (130/143). On a remote failure the CLI also stops the remote project. - node:test tests (npm test).
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.
Fixes https://testingbot-team.atlassian.net/browse/TB-964 (observed with 1.1.5 while running the Cypress tutorial).
Problems
cypress.json, or "Cypress did not respond after 20 seconds"), the CLI polled until it was killed (900 s and 420 s in the audit). There were two causes:getStatus()returned FAILED, but nothing handled it.error…session id. The web API then keeps that run READY, so the CLI only stops at its 30-minute READY cap. (Server side:CypressRunJoblacks theerror-prefixed session guard that Espresso, XCUITest and Maestro have. That is noted on the ticket and not fixed here.)exitHandlernever calledprocess.exit()when a tunnel was configured but not open.Tunnel.stop()dereferencedthis.tunnelwhile it wasundefined:TypeError: Cannot read properties of undefined (reading 'close').Changes
Poller:failure(response). A run counts as a terminal failure when its status is FAILED or unknown (the run'serrorsare included in the message), or when itstest.sessionIdstarts witherror.check()rejects on the first such poll and marks the spinner failed.Tunnel:stop()is idempotent and resolves when there is no tunnel. NewisActive().RunProject:registerCloseHandlers()runs before the tunnel starts.uncaughtExceptionandunhandledRejection.exitHandler(code)is idempotent: it stops the remote job, closes the tunnel if one is open, and always exits.stop_project, then closes the tunnel and exits 1 (as before, viafinally).npm test:node --testovertest/*.test.js, against the compiledlib/.tsc || truebecausemainalready has type errors insrc/index.ts(yargs typings) and theio.connectcall. Those are pre-existing and not touched here.Not done here:
requestwithfetch(also listed on the ticket) is a separate change. It needsenginesraised to Node ≥ 18.Verification
The tests cover:
error…session rejects on the first poll (in under 1 s, not 30 min).Tunnel.stop()without a tunnel doesn't throw, and closes an open tunnel exactly once.exitHandlerexits even when the tunnel never opened.Negative control: the same test file against
main's compiled lib hangs on the first FAILED-run test and is killed by the 60 s timeout.Live check (real tunnel on the shared account, Java 23):
RunProjectfromlib/, starts the real tunnel and registers the handlers.GET /v1/tunnel/list→[](it was also[]before the run).