[quality] pkg/agent: extended registry + provider_prompts tests (17 cases)#19921
Conversation
Adds 15+ test cases covering previously untested paths in pkg/agent: Registry (registry_extended_test.go): - Nil receiver safety for all public methods - RemoveSelectedAgent cleanup verification - promoteExecutingDefault (3 scenarios: promotion, no-change, no-better-option) - LRU eviction when selectedAgent map exceeds 10000 cap - Concurrent access safety (race detector coverage) - GetDefault with missing provider in map - SetDefault with nil provider entry - HasAvailableProviders with nil map entry Provider prompts (provider_prompts_test.go): - OSCommandHint returns non-empty, contains shell reference - OSContext matches runtime.GOOS - DefaultSystemPrompt and ChatOnlySystemPrompt non-empty and differ Partially addresses #19907. Signed-off-by: quality-agent <quality@kubestellar.io>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
🐝 Hi @clubanderson! I'm Trusted users — org members and contributors with write access — can mention Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies. |
|
👋 Hey @clubanderson — thanks for opening this PR!
This is an automated message. |
There was a problem hiding this comment.
Pull request overview
This PR improves pkg/agent quality by adding targeted Go tests that exercise previously untested/edge logic in the agent registry and provider prompt wrappers, contributing toward the coverage goals in #19907.
Changes:
- Add extended registry tests covering nil receiver behavior, session cleanup, default-agent promotion, LRU eviction behavior, and concurrent access.
- Add tests for
pkg/agentprompt wrapper exports (OSCommandHint,OSContext,DefaultSystemPrompt,ChatOnlySystemPrompt).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/agent/registry_extended_test.go | Adds broad registry behavior tests (nil-safety, default promotion, eviction, concurrency). |
| pkg/agent/provider_prompts_test.go | Adds tests validating prompt wrapper functions and exported prompt vars are populated and distinct. |
| for i := 0; i < 10000; i++ { | ||
| sid := fmt.Sprintf("old-session-%d", i) | ||
| r.selectedAgent[sid] = "a" | ||
| // All old sessions have old timestamps | ||
| r.selectedAgentLRU[sid] = time.Now().Add(-time.Hour) | ||
| } |
|
Quality review of test code: ✅ Good test patterns:
This PR partially addresses #19907 by adding tests for |
…ation Signed-off-by: clubanderson <clubanderson@users.noreply.github.com>
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
✅ Post-Merge Verification: passedCommit: |
Test Improvement
Adds 15+ test cases covering previously untested logic paths in
pkg/agent:registry_extended_test.go(11 test functions)TestRegistry_NilReceiver*RegistryTestRegistry_RemoveSelectedAgentTestRegistry_PromoteExecutingDefaultTestRegistry_PromoteExecutingDefault_NoChangeTestRegistry_PromoteExecutingDefault_NoBetterOptionTestRegistry_SetSelectedAgent_LRUEvictionTestRegistry_ConcurrentAccessTestRegistry_GetDefault_NotFoundTestRegistry_SetDefault_NilProviderTestRegistry_HasAvailableProviders_WithNilEntryprovider_prompts_test.go(6 test functions)TestOSCommandHint_NotEmptyTestOSCommandHint_ContainsShellReferenceTestOSContext_MatchesRuntimeTestDefaultSystemPrompt_NotEmptyTestChatOnlySystemPrompt_NotEmptyTestChatOnlySystemPrompt_DiffersFromDefaultPartially addresses #19907
Filed by quality agent (ACMM L4/L6 — full mode)