From 36a58950b5c03338bf6d4a5456d57e3dc539d46a Mon Sep 17 00:00:00 2001 From: Jeffrey Chen Date: Thu, 22 Jan 2026 18:52:55 +0000 Subject: [PATCH] azure.ai.agents - enable unit tests --- .../extensions/azure.ai.agents/ci-test.ps1 | 27 +++++++++++++++++++ eng/pipelines/release-ext-azure-ai-agents.yml | 1 - .../templates/jobs/build-azd-extension.yml | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 cli/azd/extensions/azure.ai.agents/ci-test.ps1 diff --git a/cli/azd/extensions/azure.ai.agents/ci-test.ps1 b/cli/azd/extensions/azure.ai.agents/ci-test.ps1 new file mode 100644 index 00000000000..2e66dea3138 --- /dev/null +++ b/cli/azd/extensions/azure.ai.agents/ci-test.ps1 @@ -0,0 +1,27 @@ +$gopath = go env GOPATH +$gotestsumBinary = "gotestsum" +if ($IsWindows) { + $gotestsumBinary += ".exe" +} +$gotestsum = Join-Path $gopath "bin" $gotestsumBinary + +Write-Host "Running unit tests..." + +if (Test-Path $gotestsum) { + # Use gotestsum for better output formatting and summary + & $gotestsum --format testname -- ./... -count=1 +} else { + # Fallback to go test if gotestsum is not installed + Write-Host "gotestsum not found, using go test..." -ForegroundColor Yellow + go test ./... -v -count=1 +} + +if ($LASTEXITCODE -ne 0) { + Write-Host "" + Write-Host "Tests failed with exit code: $LASTEXITCODE" -ForegroundColor Red + exit $LASTEXITCODE +} + +Write-Host "" +Write-Host "All tests passed!" -ForegroundColor Green +exit 0 diff --git a/eng/pipelines/release-ext-azure-ai-agents.yml b/eng/pipelines/release-ext-azure-ai-agents.yml index e7d75fee630..264bc42797e 100644 --- a/eng/pipelines/release-ext-azure-ai-agents.yml +++ b/eng/pipelines/release-ext-azure-ai-agents.yml @@ -31,4 +31,3 @@ extends: AzdExtensionId: azure.ai.agents SanitizedExtensionId: azure-ai-agents AzdExtensionDirectory: cli/azd/extensions/azure.ai.agents - SkipTests: true diff --git a/eng/pipelines/templates/jobs/build-azd-extension.yml b/eng/pipelines/templates/jobs/build-azd-extension.yml index 36d23a229e1..a12ae98d977 100644 --- a/eng/pipelines/templates/jobs/build-azd-extension.yml +++ b/eng/pipelines/templates/jobs/build-azd-extension.yml @@ -69,6 +69,7 @@ jobs: pwsh: true targetType: filePath filePath: ${{ parameters.AzdExtensionDirectory }}/ci-test.ps1 + workingDirectory: ${{ parameters.AzdExtensionDirectory }} - task: PublishTestResults@2 inputs: