-
Notifications
You must be signed in to change notification settings - Fork 888
refactor(agent): add agenttest.New helper function #9812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, love me some functional opts!
Had a few comments and suggestions, but otherwise I like the new helper. 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for noticing the need of refactoring. I see that you received a lot of comments, so I will not leave yet another evaluation. Just a few words:
Based on the part that you want to deduplicate and refactor, I would start with a basic function wrapper or function to create the agent instance, but would leave AwaitWorkspaceAgents
as is. I have a feeling that an artificial agent exposing Agent()
and Client()
is more than we currently need.
Based on the above feedback, I made the following changes:
|
SGTM! One addition that could still be made is |
All of the stuff in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Following #9789 I noticed we stand up a test agent in a number of places. This seems ripe for a test helper.
Before:
After:
Rationale:
Auto-complete gives you a nudge to call.Wait()
.I haven't moved all existing use of
agent.New()
in*_test.go
as there are some edge cases that it doesn't seem to make sense to try capturing.