Skip to content
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

[CI Environment] Updated test cases & added performance improvements #4273

Merged
merged 1 commit into from
Nov 23, 2023
Merged
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
16 changes: 7 additions & 9 deletions .azuredevops/pipelineTemplates/jobs.getModuleTestFiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ jobs:
targetType: inline
pwsh: true
script: |
# Load used functions
. (Join-Path '$(System.DefaultWorkingDirectory)' 'utilities' 'pipelines' 'sharedScripts' 'Get-ModuleTestFileList.ps1')
# Get the list of parameter file paths
$moduleFolderPath = Join-Path '$(System.DefaultWorkingDirectory)' '${{ parameters.modulePath }}'
$testFilePaths = (Get-ChildItem -Path $moduleFolderPath -Recurse -Filter 'main.test.bicep').FullName | Sort-Object

$functionInput = @{
ModulePath = Join-Path '$(System.DefaultWorkingDirectory)' '${{ parameters.modulePath }}'
$deploymentTestPaths = $testFilePaths | ForEach-Object {
$_.Replace($moduleFolderPath, '').Trim('\').Trim('/')
}

Write-Verbose "Invoke task with" -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose

# Set agent up
$deploymentTestPaths = Get-ModuleTestFileList @functionInput -Verbose
Write-Verbose 'Found module test files' -Verbose
$deploymentTestPaths | ForEach-Object { Write-Verbose "- [$_]" -Verbose }

$testTable = @{}
foreach ($deploymentTestPath in $deploymentTestPaths) {
Expand Down
17 changes: 8 additions & 9 deletions .github/actions/templates/getModuleTestFiles/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@ runs:
run: |
# Grouping task logs
Write-Output '::group::Get parameter files'
# Load used functions
. (Join-Path $env:GITHUB_WORKSPACE 'utilities' 'pipelines' 'sharedScripts' 'Get-ModuleTestFileList.ps1')

$functionInput = @{
ModulePath = Join-Path $env:GITHUB_WORKSPACE '${{ inputs.modulePath }}'
}
# Get the list of parameter file paths
$moduleFolderPath = Join-Path $env:GITHUB_WORKSPACE '${{ inputs.modulePath }}'
$testFilePaths = (Get-ChildItem -Path $moduleFolderPath -Recurse -Filter 'main.test.bicep').FullName | Sort-Object

Write-Verbose "Invoke task with" -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
$testFilePaths = $testFilePaths | ForEach-Object {
$_.Replace($moduleFolderPath, '').Trim('\').Trim('/')
}

# Get the list of parameter file paths
$testFilePaths = Get-ModuleTestFileList @functionInput -Verbose
Write-Verbose 'Found module test files' -Verbose
$testFilePaths | ForEach-Object { Write-Verbose "- [$_]" -Verbose }

# Output values to be accessed by next jobs
$compressedOutput = $testFilePaths | ConvertTo-Json -Compress
Expand Down
59 changes: 0 additions & 59 deletions utilities/pipelines/sharedScripts/Get-ModuleTestFileList.ps1

This file was deleted.

3 changes: 1 addition & 2 deletions utilities/pipelines/sharedScripts/Set-ModuleReadMe.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ function Set-UsageExamplesSection {
$moduleNameCamelCase = $First.Tolower() + (Get-Culture).TextInfo.ToTitleCase($Rest) -Replace '-'
}

$testFilePaths = Get-ModuleTestFileList -ModulePath $moduleRoot | ForEach-Object { Join-Path $moduleRoot $_ }
$testFilePaths = (Get-ChildItem -Path $ModuleRoot -Recurse -Filter 'main.test.bicep').FullName | Sort-Object

$RequiredParametersList = $TemplateFileContent.parameters.Keys | Where-Object {
Get-IsParameterRequired -TemplateFileContent $TemplateFileContent -Parameter $TemplateFileContent.parameters[$_]
Expand Down Expand Up @@ -1613,7 +1613,6 @@ function Set-ModuleReadMe {

# Load external functions
. (Join-Path $PSScriptRoot 'Get-NestedResourceList.ps1')
. (Join-Path $PSScriptRoot 'Get-ModuleTestFileList.ps1')
. (Join-Path $PSScriptRoot 'helper' 'Merge-FileWithNewContent.ps1')
. (Join-Path $PSScriptRoot 'helper' 'Get-IsParameterRequired.ps1')
. (Join-Path $PSScriptRoot 'helper' 'Get-SpecsAlignedResourceName.ps1')
Expand Down
1 change: 0 additions & 1 deletion utilities/pipelines/staticValidation/helper/helper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ $repoRootPath = (Get-Item $PSScriptRoot).Parent.Parent.Parent.Parent.FullName

. (Join-Path $repoRootPath 'utilities' 'pipelines' 'sharedScripts' 'Get-NestedResourceList.ps1')
. (Join-Path $repoRootPath 'utilities' 'pipelines' 'sharedScripts' 'Get-ScopeOfTemplateFile.ps1')
. (Join-Path $repoRootPath 'utilities' 'pipelines' 'sharedScripts' 'Get-ModuleTestFileList.ps1')
. (Join-Path $repoRootPath 'utilities' 'pipelines' 'sharedScripts' 'helper' 'ConvertTo-OrderedHashtable.ps1')
. (Join-Path $repoRootPath 'utilities' 'pipelines' 'sharedScripts' 'helper' 'Get-IsParameterRequired.ps1')
. (Join-Path $repoRootPath 'utilities' 'tools' 'Get-CrossReferencedModuleList.ps1')
Expand Down
Loading
Loading