Skip to content

Commit

Permalink
Fix-Integration-Tests (#492)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
PlagueHO authored Aug 12, 2024
1 parent 8fe296f commit 9e5f265
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 97 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
88 changes: 0 additions & 88 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/CosmosDB.integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion tests/TestHelper/AzureDeploy/AzureDeploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion tests/TestHelper/AzureDeploy/CosmosDb.bicep
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
6 changes: 3 additions & 3 deletions tests/TestHelper/TestHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -180,7 +180,7 @@ function New-AzureTestCosmosDbAccount

[Parameter()]
[System.String]
$Location = 'West US 3'
$Location = 'Australia East'
)

try
Expand Down Expand Up @@ -272,7 +272,7 @@ function New-AzureTestCosmosDbResourceGroup

[Parameter()]
[System.String]
$Location = 'West US 3'
$Location = 'Australia East'
)

try
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/CosmosDB.accounts.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9e5f265

Please sign in to comment.