Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/Azure.Mcp.Core/tests/test-resources-post.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ public AzureCloudConfiguration(
// Try to get cloud configuration from various sources in priority order:
// 1. ServiceStartOptions (--cloud command line argument)
// 2. Configuration (appsettings.json or environment variables)
// - Keys are case-insensitive
// - Usually IConfiguration is created using EnvironmentVariablesConfigurationProvider which
// includes environment variables, but we check both to be safe
var cloudValue = serviceStartOptions?.Value?.Cloud
?? configuration["AZURE_CLOUD"]
?? configuration["azure_cloud"]
?? configuration["cloud"]
?? configuration["Cloud"]
?? configuration["CLOUD"]
?? Environment.GetEnvironmentVariable("AZURE_CLOUD");

(AuthorityHost, ArmEnvironment, CloudType) = ParseCloudValue(cloudValue);
Expand Down
1 change: 1 addition & 0 deletions core/Microsoft.Mcp.Core/tests/test-resources-post.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs
)
Expand Down
8 changes: 8 additions & 0 deletions eng/pipelines/templates/jobs/live-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
timeoutInMinutes: ${{ parameters.TimeoutInMinutes }}
# The variable reference in the matrix parameter will resolve to a json map. If there are no live test legs, it will be an empty map.
condition: and(succeeded(), ne(${{ parameters.Matrix }}, '{}'))
variables:
Environment: ${{ iif(parameters.GovTest, 'AzureUSGovernment', 'AzureCloud') }}
SubscriptionConfiguration: '{"Environment": "$(Environment)"}'
strategy:
maxParallel: ${{ parameters.MaxParallel }}
matrix: $[ ${{ parameters.Matrix }} ]
Expand Down Expand Up @@ -62,6 +65,7 @@ jobs:
ServiceConnection: ${{ iif(parameters.GovTest, 'azure-mcp-gov-test', 'azure-sdk-tests-public') }}
PersistOidcToken: true
TestResourcesDirectory: $(Build.SourcesDirectory)/$(TestResourcesPath)
SubscriptionConfiguration: $(SubscriptionConfiguration)

- task: AzurePowershell@5
displayName: "Run tests (stdio) - az pwsh"
Expand All @@ -75,6 +79,7 @@ jobs:
Inline: |
./eng/scripts/Test-Code.ps1 `
-TestType 'Live' `
-Environment $(Environment) `
-Path $(PathToTest) `
-TestResultsPath '$(Build.ArtifactStagingDirectory)/testResults'

Expand All @@ -87,6 +92,7 @@ jobs:
ServiceConnection: ${{ iif(parameters.GovTest, 'azure-mcp-gov-test', 'azure-sdk-tests-public') }}
PersistOidcToken: true
TestResourcesDirectory: $(Build.SourcesDirectory)/$(TestResourcesPath)
SubscriptionConfiguration: $(SubscriptionConfiguration)
AdditionalParameters: "@{ UseHttpTransport = true }"

- task: AzurePowershell@5
Expand All @@ -101,6 +107,7 @@ jobs:
Inline: |
./eng/scripts/Test-Code.ps1 `
-TestType 'Live' `
-Environment $(Environment) `
-Path $(PathToTest) `
-TestResultsPath '$(Build.ArtifactStagingDirectory)/testResults'

Expand All @@ -122,3 +129,4 @@ jobs:
ServiceConnection: ${{ iif(parameters.GovTest, 'azure-mcp-gov-test', 'azure-sdk-tests-public') }}
EnvVars:
Pool: $(Pool)
SubscriptionConfiguration: $(SubscriptionConfiguration)
5 changes: 4 additions & 1 deletion eng/scripts/Test-Code.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ param(
[string[]] $Members,
[ValidateSet('Live', 'Unit', 'All', 'Recorded')]
[string] $TestType = 'Unit',
[ValidateSet('AzureCloud', 'AzureUSGovernment', 'AzureChinaCloud')]
[string] $Environment = 'AzureCloud',
[string] $TestResultsPath,
[switch] $CollectCoverage,
[switch] $OpenReport,
Expand Down Expand Up @@ -298,11 +300,12 @@ try {
exit $LastExitCode
}

$environmentArg = "--environment AZURE_CLOUD=$Environment"
$coverageArg = $CollectCoverage ? "--collect:'XPlat Code Coverage'" : ""
$resultsArg = "--results-directory '$TestResultsPath'"
$loggerArg = "--logger 'trx' --logger 'console;verbosity=detailed'"

$command = "dotnet test $coverageArg $resultsArg $loggerArg"
$command = "dotnet test $coverageArg $resultsArg $loggerArg $environmentArg"

if($Members.Count -gt 0) {
$memberFilterString = $Members | ForEach-Object { "FullyQualifiedName~$_" } | Join-String -Separator '|'
Expand Down

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions servers/Azure.Mcp.Server/tests/test-resources-post.ps1

This file was deleted.

24 changes: 0 additions & 24 deletions servers/Azure.Mcp.Server/tests/test-resources.bicep

This file was deleted.

1 change: 1 addition & 0 deletions tools/Azure.Mcp.Tools.Acr/tests/test-resources-post.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param(
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $BaseName,
[string] $Environment,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
)
Expand Down
1 change: 1 addition & 0 deletions tools/Azure.Mcp.Tools.Aks/tests/test-resources-post.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
4 changes: 2 additions & 2 deletions tools/Azure.Mcp.Tools.Aks/tests/test-resources.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ param location string = resourceGroup().location == 'westus' ? 'westus2' : resou
@description('The client OID to grant access to test resources.')
param testApplicationOid string

@description('The VM size for the AKS node pool. Default is Standard_F2 which is the smallest VM that meets AKS system node pool requirements (2 vCPUs, 4 GB RAM).')
param nodeVmSize string = 'Standard_D2lds_v5'
@description('The VM size for the AKS node pool. Default is Standard_D2lds_v5.')
param nodeVmSize string = environment().name == 'AzureUSGovernment' ? 'Standard_D2alds_v6' : 'Standard_D2lds_v5'

// Create a basic AKS cluster for testing
resource aksCluster 'Microsoft.ContainerService/managedClusters@2024-02-01' = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string] $TenantId,
[string] $TestApplicationId,
[string] $ResourceGroupName,
[string] $Environment,
[string] $BaseName,
[hashtable] $DeploymentOutputs,
[hashtable] $AdditionalParameters
Expand Down
Loading