Skip to content

feat(agent): add StrictContextMock test double for unified Context#1015

Draft
wolo-lab wants to merge 1 commit into
v2from
wolo/v2-strict-context-mock
Draft

feat(agent): add StrictContextMock test double for unified Context#1015
wolo-lab wants to merge 1 commit into
v2from
wolo/v2-strict-context-mock

Conversation

@wolo-lab

Copy link
Copy Markdown
Contributor

After the context unification, the unified Context interface gained many methods. Out-of-tree consumers that hand-implement tool.Context (e.g. a fakeToolContext in tests) break whenever the interface grows, since Go requires every method to be present.

StrictContextMock implements the full Context surface so it can be embedded in a test fake; embedders keep compiling as Context grows. ADK methods panic with "not implemented" (a loud failure on unexpected calls), while the context.Context methods (Deadline/Done/Err/Value) delegate to the wrapped Ctx. This complements the existing ContextMock, which returns zero values.

After the context unification, the unified Context interface gained many
methods. Out-of-tree consumers that hand-implement tool.Context (e.g. a
fakeToolContext in tests) break whenever the interface grows, since Go
requires every method to be present.

StrictContextMock implements the full Context surface so it can be embedded
in a test fake; embedders keep compiling as Context grows. ADK methods panic
with "not implemented" (a loud failure on unexpected calls), while the
context.Context methods (Deadline/Done/Err/Value) delegate to the wrapped
Ctx. This complements the existing ContextMock, which returns zero values.
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.

1 participant