From 9e5f2657dd5bf5e3bb6848e428101bbb72348d5f Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Mon, 12 Aug 2024 19:06:38 +1200 Subject: [PATCH] Fix-Integration-Tests (#492) * Update integration test region to 'Australia East' * Update integration test region to 'Australia East' and remove MacOS-11 testing from build pipeline * Fix pipeline build step and update integration test region --- CHANGELOG.md | 6 +- azure-pipelines.yml | 88 ------------------- .../CosmosDB.integration.Tests.ps1 | 2 +- .../TestHelper/AzureDeploy/AzureDeploy.bicep | 2 +- tests/TestHelper/AzureDeploy/CosmosDb.bicep | 2 +- tests/TestHelper/TestHelper.psm1 | 6 +- tests/Unit/CosmosDB.accounts.Tests.ps1 | 2 +- 7 files changed, 11 insertions(+), 97 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca0bee6..a9d8ae3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed pipeline build step by limiting Gitversion to 5.* version. -- Change default integration test region from `East US` to `West US 3` due to - quota limitations. +- Change default integration test region from `East US` to `Australia East` due + to quota limitations. +- Removed MacOS-11 testing from build pipeline because it is no longer supported + by Microsoft managed Azure DevOps images. ## [5.0.0] - 2024-06-07 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index aa181a7..0cd8fb0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -379,94 +379,6 @@ stages: testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml' testRunTitle: 'Integration (Powershell 7 on Ubuntu 22.04)' - - job: Unit_Test_PSCore6_MacOS11 - displayName: 'Unit Test (Powershell Core 6 on MacOS 11)' - pool: - vmImage: macos-11 - - steps: - - powershell: | - $repositoryOwner,$repositoryName = $env:BUILD_REPOSITORY_NAME -split '/' - echo "##vso[task.setvariable variable=RepositoryOwner;isOutput=true]$repositoryOwner" - echo "##vso[task.setvariable variable=RepositoryName;isOutput=true]$repositoryName" - name: moduleBuildVariable - displayName: 'Set Environment Variables' - - - task: DownloadPipelineArtifact@2 - displayName: 'Download Pipeline Artifact' - inputs: - buildType: 'current' - artifactName: $(buildArtifactName) - targetPath: '$(Build.SourcesDirectory)/$(buildArtifactName)' - - - powershell: | - Uninstall-Module -Name Az -Force - displayName: 'Uninstall Az Module' - - - task: PowerShell@2 - name: test - displayName: 'Run Unit Test' - inputs: - filePath: './build.ps1' - arguments: "-tasks test -PesterScript 'tests/Unit'" - - - task: PublishTestResults@2 - displayName: 'Publish Test Results' - condition: succeededOrFailed() - inputs: - testResultsFormat: 'NUnit' - testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml' - testRunTitle: 'Unit (Powershell Core 6 on MacOS 11)' - - - task: PublishCodeCoverageResults@2 - displayName: 'Publish Code Coverage' - condition: succeededOrFailed() - inputs: - summaryFileLocation: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)/CodeCov*.xml' - pathToSources: '$(Build.SourcesDirectory)/$(sourceFolderName)/' - - - job: Integration_Test_PSCore6_MacOS11 - dependsOn: Unit_Test_PSCore6_MacOS11 - displayName: 'Integration Test (Powershell Core 6 on MacOS 11)' - pool: - vmImage: macos-11 - timeoutInMinutes: 0 - - steps: - - task: DownloadPipelineArtifact@2 - displayName: 'Download Pipeline Artifact' - inputs: - buildType: 'current' - artifactName: $(buildArtifactName) - targetPath: '$(Build.SourcesDirectory)/$(buildArtifactName)' - - - powershell: | - Uninstall-Module -Name Az -Force - $null = Remove-Item -Path '~/.Azure' -Recurse -Force - displayName: 'Uninstall Az Module' - - - task: PowerShell@2 - name: test - displayName: 'Run Integration Test' - env: - azureApplicationId: $(azureApplicationId) - azureApplicationPassword: $(azureApplicationPassword) - azureSubscriptionId: $(azureSubscriptionId) - azureTenantId: $(azureTenantId) - azureAppicationObjectId: $(azureAppicationObjectId) - inputs: - filePath: './build.ps1' - arguments: "-Tasks test -PesterScript 'tests/Integration' -CodeCoverageThreshold 0" - pwsh: false - - - task: PublishTestResults@2 - displayName: 'Publish Test Results' - condition: succeededOrFailed() - inputs: - testResultsFormat: 'NUnit' - testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml' - testRunTitle: 'Integration (Powershell Core 6 on MacOS 11)' - - job: Unit_Test_PSCore6_MacOS12 displayName: 'Unit Test (Powershell Core 6 on MacOS 12)' pool: diff --git a/tests/Integration/CosmosDB.integration.Tests.ps1 b/tests/Integration/CosmosDB.integration.Tests.ps1 index 89b9a79..c5abb5b 100644 --- a/tests/Integration/CosmosDB.integration.Tests.ps1 +++ b/tests/Integration/CosmosDB.integration.Tests.ps1 @@ -49,7 +49,7 @@ if ([System.String]::IsNullOrEmpty($script:testBuildSystem)) $script:testResourceGroupName = ('cdbtestrgp-{0}-{1}-{2}' -f $script:testRandomName,$script:testBuildSystem,$script:testBuildBranch) $script:testAccountName = ('cdbtest{0}' -f $script:testRandomName) -$script:testLocation = 'West US 3' +$script:testLocation = 'Australia East' $script:testCorsAllowedOrigins = @('https://www.contoso.com', 'https://www.fabrikam.com') $script:testOffer = 'testOffer' $script:testDatabase = 'testDatabase' diff --git a/tests/TestHelper/AzureDeploy/AzureDeploy.bicep b/tests/TestHelper/AzureDeploy/AzureDeploy.bicep index 43293fb..8da89ff 100644 --- a/tests/TestHelper/AzureDeploy/AzureDeploy.bicep +++ b/tests/TestHelper/AzureDeploy/AzureDeploy.bicep @@ -2,7 +2,7 @@ targetScope = 'subscription' param resourceGroupName string param accountName string -param location string = 'West US 3' +param location string = 'Australia East' param principalId string @allowed([ '00000000-0000-0000-0000-000000000001'// Built-in role 'Azure Cosmos DB Built-in Data Reader' diff --git a/tests/TestHelper/AzureDeploy/CosmosDb.bicep b/tests/TestHelper/AzureDeploy/CosmosDb.bicep index 255c82c..69f6c3d 100644 --- a/tests/TestHelper/AzureDeploy/CosmosDb.bicep +++ b/tests/TestHelper/AzureDeploy/CosmosDb.bicep @@ -1,5 +1,5 @@ param accountName string -param location string = 'West US 3' +param location string = 'Australia East' param principalId string @allowed([ '00000000-0000-0000-0000-000000000001'// Built-in role 'Azure Cosmos DB Built-in Data Reader' diff --git a/tests/TestHelper/TestHelper.psm1 b/tests/TestHelper/TestHelper.psm1 index 42ecdd4..ef99d89 100644 --- a/tests/TestHelper/TestHelper.psm1 +++ b/tests/TestHelper/TestHelper.psm1 @@ -148,7 +148,7 @@ function Get-AzureEntraIdToken The name of the resource group where the Azure Cosmos DB account will be created. .PARAMETER Location - The Azure region where the Azure Cosmos DB account will be created. Defaults to 'West US 3'. + The Azure region where the Azure Cosmos DB account will be created. Defaults to 'Australia East'. .EXAMPLE New-AzureTestCosmosDbAccount -ObjectId '12345678-1234-1234-1234-123456789012' -AccountName 'testCosmosDb' -ResourceGroupName 'testResourceGroup' @@ -180,7 +180,7 @@ function New-AzureTestCosmosDbAccount [Parameter()] [System.String] - $Location = 'West US 3' + $Location = 'Australia East' ) try @@ -272,7 +272,7 @@ function New-AzureTestCosmosDbResourceGroup [Parameter()] [System.String] - $Location = 'West US 3' + $Location = 'Australia East' ) try diff --git a/tests/Unit/CosmosDB.accounts.Tests.ps1 b/tests/Unit/CosmosDB.accounts.Tests.ps1 index b438b99..3f55d10 100644 --- a/tests/Unit/CosmosDB.accounts.Tests.ps1 +++ b/tests/Unit/CosmosDB.accounts.Tests.ps1 @@ -19,7 +19,7 @@ InModuleScope $ProjectName { $script:testResourceGroupName = 'testResourceGroupName' $script:testLocation = 'North Central US' $script:testLocationRead1 = 'South Central US' - $script:testLocationRead2 = 'West US 3' + $script:testLocationRead2 = 'Australia East' $script:testIpRangeFilter = @('10.0.0.1/8', '10.0.0.2/8') $script:testConsistencyLevel = 'Strong' $script:testMaxIntervalInSeconds = 60