mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed? Add a default 90s timeout to individual tests using the `testcore.NewEnv` for setup. Tests should use the `context.Context` returned from `testcore.NewEnv(...)` to fail early when a test exceeds the timeout. ## Why? Go only allows to set a timeout for an entire test run via `go test`, but a single test case can make the entire run be stuck for the full test timeout time. This change will make those tests exit early speeding up the dev process. ## How did you test it? - [ ] built - [X] run locally and tested manually - [X] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s) ## Potential risks Test change only, could introduce flakes if tests did not have previous context timeouts. --- > [!NOTE] > **Medium Risk** > Touches shared test infrastructure and changes how contexts/timeouts are created and propagated across functional tests, which could introduce new test flakes or premature cancellations if timeouts are too aggressive. > > **Overview** > Functional tests created via `testcore.NewEnv` now get a *test-scoped* timeout context (default **90s**, configurable via `TEMPORAL_TEST_TIMEOUT` or per-test `testcore.WithTimeout`) that is canceled on timeout and fails the test during cleanup. > > `testcore.NewContext` is updated to optionally derive from a parent context, and key functional tests are migrated to pass `s.Context()`/`env.Context()` into RPC calls and `context.WithTimeout(...)` to respect cancellations. Linting/docs are updated to discourage `context.Background()` in tests and document the new timeout knob. > > <sup>Written by [Cursor Bugbot]() for commit 98852a5e43d62aec769af4caae7de9783f314065. This will update automatically on new commits. Configure [here]().</sup>