-
Notifications
You must be signed in to change notification settings - Fork 49
Init E2E Integration Test #189
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
c920fc1
Fix: Load dotenv in agent.ts before AgentApplication instantiates
rahuldevikar761 7efd5bc
Merge branch 'main' of https://github.com/microsoft/Agent365-Samples
rahuldevikar761 d69473b
Merge branch 'main' of https://github.com/microsoft/Agent365-Samples
rahuldevikar761 0787e88
Merge branch 'main' of https://github.com/microsoft/Agent365-Samples
rahuldevikar761 cfb8048
Add E2E Integration Tests
rahuldevikar761 b59f38c
Restore E2E test workflow for agent samples
rahuldevikar761 593ccca
Refactor Start-Agent.ps1 with updated comments
rahuldevikar761 e225bfc
Restore E2E tests for agent samples
rahuldevikar761 1cdb755
Improve error handling in Start-Agent.ps1
rahuldevikar761 770407f
Update Start-Agent.ps1 with new comments and structure
rahuldevikar761 7300864
Update print statement from 'Hello' to 'Goodbye'
rahuldevikar761 8b60d32
Enhance Start-Agent.ps1 with runtime checks and logging
rahuldevikar761 da97048
Update Start-Agent.ps1
rahuldevikar761 1c20001
Update log capture script for agent logs
rahuldevikar761 78e5ab1
Update e2e-agent-samples.yml
rahuldevikar761 a372f3f
Add GitHub Actions E2E workflow with self-contained tests
rahuldevikar761 d22c67e
Add /api/health endpoint to dotnet samples for CI/CD health checks
rahuldevikar761 d3f6934
Fix DateTime reference - use fully qualified System.DateTime
rahuldevikar761 f3d964e
Add null check for response before accessing StatusCode
rahuldevikar761 b77c497
Add E2E test status badges to README
rahuldevikar761 e87c96a
Address PR review comments
rahuldevikar761 0c09fbd
Add nightly schedule to run E2E tests at 10 PM UTC
rahuldevikar761 3bc1c87
Add nightly schedule to run E2E tests at 10 PM UTC
rahuldevikar761 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Acquires a bearer token using Resource Owner Password Credentials (ROPC) flow. | ||
|
|
||
| .DESCRIPTION | ||
| MCP servers only support delegated (user) permissions, not application permissions. | ||
| This script uses ROPC flow with a test service account to acquire user-delegated | ||
| tokens in the CI/CD pipeline. | ||
|
|
||
| .PARAMETER ClientId | ||
| The application (client) ID with MCP permissions. | ||
|
|
||
| .PARAMETER TenantId | ||
| The Azure AD tenant ID. | ||
|
|
||
| .PARAMETER Username | ||
| The test service account UPN (should be excluded from MFA). | ||
|
|
||
| .PARAMETER Password | ||
| The test service account password. | ||
|
|
||
| .PARAMETER Scope | ||
| The scope to request. Defaults to MCP scope. | ||
|
|
||
| .OUTPUTS | ||
| Returns the access token as a string. | ||
|
|
||
| .EXAMPLE | ||
| $token = ./Acquire-BearerToken.ps1 -ClientId $clientId -TenantId $tenantId -Username $user -Password $pass | ||
| #> | ||
|
|
||
| param( | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$ClientId, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [string]$TenantId, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [string]$Username, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [string]$Password, | ||
|
|
||
| [Parameter(Mandatory = $false)] | ||
| [string]$Scope = "ea9ffc3e-8a23-4a7d-836d-234d7c7565c1/.default" | ||
| ) | ||
|
|
||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| Write-Host "Acquiring bearer token for MCP servers using ROPC flow..." -ForegroundColor Cyan | ||
| Write-Host "MCP servers require delegated (user) tokens, not service principal tokens" -ForegroundColor Gray | ||
|
|
||
| $body = @{ | ||
| grant_type = "password" | ||
| client_id = $ClientId | ||
| scope = $Scope | ||
| username = $Username | ||
| password = $Password | ||
| } | ||
|
|
||
| $tokenEndpoint = "https://login.microsoftonline.com/$TenantId/oauth2/v2.0/token" | ||
|
|
||
| try { | ||
| $response = Invoke-RestMethod -Uri $tokenEndpoint -Method POST -Body $body -ContentType "application/x-www-form-urlencoded" | ||
| $token = $response.access_token | ||
|
|
||
| if ([string]::IsNullOrEmpty($token)) { | ||
| throw "Token response did not contain access_token" | ||
| } | ||
|
|
||
| $tokenLength = $token.Length | ||
| $expiresIn = $response.expires_in | ||
| Write-Host "Bearer token acquired successfully" -ForegroundColor Green | ||
| Write-Host " Token length: $tokenLength characters" -ForegroundColor Gray | ||
| Write-Host " Expires in: $expiresIn seconds" -ForegroundColor Gray | ||
|
|
||
| # Return the token | ||
| return $token | ||
| } | ||
| catch { | ||
| Write-Error "Failed to acquire bearer token via ROPC: $_" | ||
| Write-Host "Ensure the following variables are set:" -ForegroundColor Yellow | ||
| Write-Host " - ClientId: App registration with MCP permissions" -ForegroundColor Yellow | ||
| Write-Host " - TenantId: Azure AD tenant ID" -ForegroundColor Yellow | ||
| Write-Host " - Username: Service account UPN (excluded from MFA)" -ForegroundColor Yellow | ||
| Write-Host " - Password: Service account password" -ForegroundColor Yellow | ||
| throw | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Captures and displays agent logs for debugging. | ||
|
|
||
| .DESCRIPTION | ||
| Reads agent log files and displays them with sensitive values redacted. | ||
|
|
||
| .PARAMETER AgentPath | ||
| The path to the agent directory. | ||
|
|
||
| .EXAMPLE | ||
| ./Capture-AgentLogs.ps1 -AgentPath "./sample-agent" | ||
| #> | ||
|
|
||
| param( | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$AgentPath | ||
| ) | ||
|
|
||
| Write-Host "========================================" -ForegroundColor Cyan | ||
| Write-Host "AGENT LOGS (transcript)" -ForegroundColor Cyan | ||
| Write-Host "========================================" -ForegroundColor Cyan | ||
|
|
||
| $logFile = Join-Path $AgentPath "agent.log" | ||
| if (Test-Path $logFile) { | ||
| Write-Host "Agent transcript file found at: $logFile" -ForegroundColor Green | ||
| Write-Host "----------------------------------------" | ||
| Get-Content $logFile | ||
| Write-Host "----------------------------------------" | ||
|
rahuldevikar761 marked this conversation as resolved.
|
||
| Write-Host "End of agent transcript" -ForegroundColor Green | ||
| } | ||
| else { | ||
| Write-Host "No agent.log file found at: $logFile" -ForegroundColor Yellow | ||
| } | ||
|
|
||
| # Check command output log | ||
| $outputLogFile = Join-Path $AgentPath "agent-output.log" | ||
| if (Test-Path $outputLogFile) { | ||
| $outputContent = Get-Content $outputLogFile -Raw | ||
| if (-not [string]::IsNullOrWhiteSpace($outputContent)) { | ||
| Write-Host "" | ||
| Write-Host "========================================" -ForegroundColor Cyan | ||
| Write-Host "AGENT COMMAND OUTPUT" -ForegroundColor Cyan | ||
| Write-Host "========================================" -ForegroundColor Cyan | ||
| Write-Host $outputContent | ||
| } | ||
| } | ||
|
|
||
| # Show .env file contents (redacted) | ||
| $envFile = Join-Path $AgentPath ".env" | ||
| if (Test-Path $envFile) { | ||
| Write-Host "" | ||
| Write-Host "========================================" -ForegroundColor Cyan | ||
| Write-Host ".ENV FILE (secrets redacted)" -ForegroundColor Cyan | ||
| Write-Host "========================================" -ForegroundColor Cyan | ||
| Get-Content $envFile | ForEach-Object { | ||
| if ($_ -match '^(BEARER_TOKEN|.*SECRET|.*PASSWORD|.*KEY)=') { | ||
| $name = $_ -replace '=.*', '' | ||
| $value = $_ -replace '^[^=]+=', '' | ||
| Write-Host "$name=***REDACTED*** (length: $($value.Length))" | ||
| } | ||
| else { | ||
| Write-Host $_ | ||
| } | ||
| } | ||
| } | ||
|
|
||
| # Show wrapper script (redacted) | ||
| $wrapperScript = Join-Path $AgentPath "run-agent.ps1" | ||
| if (Test-Path $wrapperScript) { | ||
| Write-Host "" | ||
| Write-Host "========================================" -ForegroundColor Cyan | ||
| Write-Host "WRAPPER SCRIPT (tokens redacted)" -ForegroundColor Cyan | ||
| Write-Host "========================================" -ForegroundColor Cyan | ||
| Get-Content $wrapperScript | ForEach-Object { | ||
| if ($_ -match "BEARER_TOKEN\s*=\s*'") { | ||
| Write-Host "`$env:BEARER_TOKEN = '***REDACTED***'" | ||
| } | ||
| else { | ||
| Write-Host $_ | ||
| } | ||
| } | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Copies the centralized ToolingManifest.json to a sample agent directory. | ||
|
|
||
| .DESCRIPTION | ||
| Creates a standardized ToolingManifest.json for E2E testing with MCP servers. | ||
|
|
||
| .PARAMETER TargetPath | ||
| The path to the sample agent directory. | ||
|
|
||
| .EXAMPLE | ||
| ./Copy-ToolingManifest.ps1 -TargetPath "./python/openai/sample-agent" | ||
| #> | ||
|
|
||
| param( | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$TargetPath | ||
| ) | ||
|
|
||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| Write-Host "Copying ToolingManifest.json to: $TargetPath" -ForegroundColor Cyan | ||
|
rahuldevikar761 marked this conversation as resolved.
|
||
|
|
||
| # Standard ToolingManifest.json for E2E testing | ||
| $manifest = @{ | ||
| mcpServers = @( | ||
| @{ | ||
| mcpServerName = "mcp_MailTools" | ||
| mcpServerUniqueName = "mcp_MailTools" | ||
| } | ||
| ) | ||
| } | ||
|
|
||
| $manifestPath = Join-Path $TargetPath "ToolingManifest.json" | ||
| $manifest | ConvertTo-Json -Depth 5 | Out-File -FilePath $manifestPath -Encoding utf8 | ||
|
|
||
| Write-Host "ToolingManifest.json created at: $manifestPath" -ForegroundColor Green | ||
| Write-Host "Contents:" -ForegroundColor Gray | ||
| Get-Content $manifestPath | Write-Host | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.