Add unit tests and testdata for azure.ai.agents extension#7634
Merged
glharper merged 3 commits intotrangevi/toolboxfrom Apr 10, 2026
Merged
Add unit tests and testdata for azure.ai.agents extension#7634glharper merged 3 commits intotrangevi/toolboxfrom
glharper merged 3 commits intotrangevi/toolboxfrom
Conversation
Add 86 new unit tests across 5 previously untested or undertested packages in the azure.ai.agents extension, raising total test count from 183 to 269. Coverage improvements: - agent_yaml: 23.1% -> 53.8% (map.go YAML-to-API mapping fully tested) - registry_api: 0% -> 28.8% (tool conversion, parameter conversion, merge) - agent_api: 0% -> tested (JSON round-trip for all model types) - cmd: 23.0% -> 23.6% (copyDirectory, copyFile, buildAgentEndpoint) New test files: - agent_yaml/map_test.go: 44 tests for YAML-to-API transform functions - registry_api/helpers_test.go: 35 tests for pure conversion helpers - agent_api/models_test.go: 24 JSON serialization round-trip tests - cmd/init_copy_test.go: directory/file copy logic tests - cmd/agent_context_test.go: endpoint construction test - agent_yaml/testdata_test.go: fixture-based parsing + regression tests New testdata fixtures (7 YAML files): - 3 valid agents (minimal prompt, full prompt, hosted) - 1 MCP tools agent - 3 invalid manifests (no kind, no model, empty template) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jongio
reviewed
Apr 10, 2026
Member
jongio
left a comment
There was a problem hiding this comment.
Solid test additions - good edge case coverage and clean table-driven pattern throughout. One convention note inline.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/models_test.go
Outdated
Show resolved
Hide resolved
Replace the generic ptr[T](v T) *T helper function with Go 1.26's built-in new(val) pattern in models_test.go and helpers_test.go, consistent with map_test.go and AGENTS.md conventions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
trangevi
added a commit
that referenced
this pull request
Apr 10, 2026
)" This reverts commit af85a8f.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds 86 new unit tests and 7 testdata fixtures for the
azure.ai.agentsextension, raising the total test count from 183 to 269. All new tests are pure-function unit tests that require no external dependencies.Coverage Improvements
agent_yamlregistry_apiagent_apicmdNew Test Files
Phase 1: Pure Function Tests
agent_yaml/map_test.go(44 tests) - YAML-to-API mapping functionsregistry_api/helpers_test.go(35 tests) - Tool conversion, parameter conversion, manifest merge, placeholder injectionagent_api/models_test.go(24 tests) - JSON round-trip serialization for all model typescmd/init_copy_test.go- copyDirectory, copyFile logic testscmd/agent_context_test.go- buildAgentEndpoint construction testPhase 4: Testdata Fixtures
agent_yaml/testdata/: 3 valid agents, 1 MCP tools agent, 3 invalid manifestsagent_yaml/testdata_test.go(14 subtests) - Fixture-based parsing + regression tests againsttests/samples/Test Conventions Followed
t.Runandt.Parallel()testingin packages that don't use testify;testify/assert+requirewhere already establishednew(val),t.Context(),t.TempDir())