Add --new-command-timeout to set appium:newCommandTimeout#125
Conversation
Add a --new-command-timeout flag (env MAESTRO_NEW_COMMAND_TIMEOUT) that sets appium:newCommandTimeout (seconds) on the Appium session when it is not already present in --caps. An explicit appium:newCommandTimeout in the caps file stays authoritative and is never overridden. This gives a way to raise the session command timeout without editing the caps file, which matters for cloud --parallel runs: sessions are created serially before any flow runs, so the earliest sessions idle during the pre-creation phase and can be reaped at the server default, failing the first flow with "invalid session id". - Flag + env var in GlobalFlags - RunConfig.NewCommandTimeout wired from the flag - createAppiumDriver injects appium:newCommandTimeout only when absent - Tests: flag registration, injection-when-absent, explicit caps value preserved, and default-unset behavior Refs devicelab-dev#124
|
Thanks @JSap0914 — this is a careful, well-built PR: the diagnosis is exactly right (option (a) already holds on That said, I'm going to pass on the flag itself, and I want to lay out the reasoning transparently since you put real thought in:
So the net is: the flag is redundant with I'd love to keep your verbatim-forwarding test as a standalone regression guard (with credit to you) — would you be up for a trimmed PR that keeps just Really appreciate the contribution and the clear write-up — please keep them coming. |
What
Adds a
--new-command-timeout <seconds>flag (envMAESTRO_NEW_COMMAND_TIMEOUT) that setsappium:newCommandTimeouton the Appium session when it isn't already set in--caps. An explicitappium:newCommandTimeoutin the caps file stays authoritative and is never overridden.Why
Issue #124 lists two acceptable fixes: (a) honor
appium:newCommandTimeoutfrom--caps, or (b) provide a flag/env var to set it.main.createAppiumDriverstarts from the caps file and never rewritesappium:newCommandTimeout, so a caps value like300reaches thecreateSessionrequest unchanged. The addedTestCreateAppiumDriver_CapsNewCommandTimeoutPreservedlocks this in.--helpexposes no--new-command-timeout, so a user who can't or doesn't want to edit the caps file (e.g. cloud-generated caps) had no way to raise it. With--parallel N, sessions are created serially before any flow runs, so the earliest sessions idle during pre-creation and get reaped at the server default — the first flow then fails withinvalid session id.This PR adds (b). It is off by default (
0= leave unset) and only fills inappium:newCommandTimeoutwhen neitherappium:newCommandTimeoutnor a barenewCommandTimeoutis present in the caps.How
--new-command-timeoutIntFlag(envMAESTRO_NEW_COMMAND_TIMEOUT) inGlobalFlags.RunConfig.NewCommandTimeout, sourced from the flag.createAppiumDriverinjectsappium:newCommandTimeoutonly when it is absent from--caps.CHANGELOG.mdentry underUnreleased.Tests
go test ./pkg/cli/ -run NewCommandTimeout:TestGlobalFlags_NewCommandTimeoutFlag— flag + env var registered.TestCreateAppiumDriver_NewCommandTimeoutInjectedWhenAbsent— flag injects300when caps omit it.TestCreateAppiumDriver_CapsNewCommandTimeoutPreserved— caps300is preserved even with the flag set to90(an explicit value always wins).TestCreateAppiumDriver_NewCommandTimeoutUnsetByDefault— no flag + no caps value means nothing is added.gofmt -landgo vet ./pkg/cli/...are clean on the touched files.Fixes #124