Add Phase 4 coverage tests for exec, auth, extensions, ioc, cmd/add#7528
Add Phase 4 coverage tests for exec, auth, extensions, ioc, cmd/add#7528jongio merged 1 commit intoAzure:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new wave of unit tests (“Phase 4”) to significantly improve code coverage across several core azd packages (IoC, extensions, exec, auth) plus internal/cmd/add.
Changes:
- Adds comprehensive DI container tests covering registration, scoping, named bindings, and error behavior.
- Adds new
exectests for redaction helpers andRunResult/ExitErrorconstruction + formatting. - Adds new tests across
auth,extensions, andinternal/cmd/addfor request formatting, caching/concurrency, command resolution, runner invocation, and add-flow helpers.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/pkg/ioc/container_coverage_test.go | Broad IoC container coverage: register/resolve, scopes, named bindings, error paths |
| cli/azd/pkg/extensions/runner_test.go | Tests for invoking extensions, env propagation, streams/interactive behavior, error wrapping |
| cli/azd/pkg/extensions/extension_test.go | Tests extension lifecycle readiness signaling and concurrent reported-error access |
| cli/azd/pkg/extensions/command_resolver_test.go | Tests command path and flag resolution edge cases for extension commands |
| cli/azd/pkg/exec/sanitizer_test.go | Tests argument/message redaction behavior for sensitive data patterns |
| cli/azd/pkg/exec/runresult_test.go | Tests RunResult and ExitError construction and error formatting behavior |
| cli/azd/pkg/auth/remote_credential_test.go | Httptest-based coverage for RemoteCredential request/response handling |
| cli/azd/pkg/auth/credential_providers_test.go | Tests multi-tenant credential provider caching and concurrent access behavior |
| cli/azd/internal/cmd/add/add_coverage_test.go | Coverage tests for azd add helpers (configure, port selection, diffs, preview writer) |
eaa5ac4 to
1f76b5c
Compare
Add 9 new test files improving coverage across 5 packages: - pkg/ioc: 36.2% -> 95.0% (comprehensive DI container tests) - pkg/auth: 80.0% -> 80.2% (RemoteCredential + MultiTenantCredentialProvider) - pkg/extensions: 75.1% -> 79.3% (CommandResolver + Extension + Runner) - pkg/exec: 69.5% -> 72.9% (sanitizer regex + RunResult/ExitError) - internal/cmd/add: 16.1% -> 26.7% (Configure, PromptPort, DiffBlocks) Total: 175 new test cases, all table-driven, parallel-safe. Passed MQ quality gate (dual-model CR + SecOps + lint + 883 tests). Part of Azure#7524 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1f76b5c to
ca73803
Compare
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|

Summary
Add 9 new test files with 175 test cases improving coverage across 5 packages:
pkg/iocpkg/extensionspkg/execinternal/cmd/addpkg/authNew Test Files
pkg/ioc/container_coverage_test.go— Comprehensive DI container tests (register, resolve, singleton lifecycle, scoped containers, named registrations, thread safety)pkg/exec/sanitizer_test.go— 21 tests forRedactSensitiveArgs+RedactSensitiveDatacovering all 7 regex patternspkg/exec/runresult_test.go— 16 tests forRunResult/ExitErrorconstruction, formatting,Unwrappkg/auth/remote_credential_test.go— 16 httptest-based tests forRemoteCredential.GetTokenpkg/auth/credential_providers_test.go— 10 tests forMultiTenantCredentialProvidercaching + concurrencypkg/extensions/command_resolver_test.go— 27 tests forResolveCommandPath/ResolveCommandFlags(100% function coverage)pkg/extensions/extension_test.go— 12 tests for lifecycle, capabilities, concurrency (100% function coverage)pkg/extensions/runner_test.go— 14 tests forInvoke, env propagation, error wrapping (96.7% coverage)internal/cmd/add/add_coverage_test.go— 39 tests for Configure, PromptPort, DiffBlocks, previewWriterQuality
testify/requirePart of #7524