Skip to content

Commit

Permalink
Remove Parallel Powershell Jobs (#82)
Browse files Browse the repository at this point in the history
* Unparallelize tests

* Moved location of pipeline file

* Remove the parallel invoke expression calls

* Add templates to testing
  • Loading branch information
jonathan-innis authored Nov 9, 2021
1 parent ef59f15 commit b2eaf5e
Show file tree
Hide file tree
Showing 9 changed files with 481 additions and 458 deletions.
15 changes: 12 additions & 3 deletions testing/Test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param (
[string] $Path,
[switch] $SkipInstall,
[switch] $CI,
[switch] $ParallelCI,
[switch] $OnlyPublicTests,

[Parameter(Mandatory=$True)]
Expand Down Expand Up @@ -40,9 +41,9 @@ if ($Type -eq 'k8s-extension') {
}
}
if ($OnlyPublicTests) {
$testFilePaths = "$PSScriptRoot/test/extensions/public"
$testFilePath = "$PSScriptRoot/test/extensions/public"
} else {
$testFilePaths = "$PSScriptRoot/test/extensions/public", "$PSScriptRoot/test/extensions/private-preview"
$testFilePath = "$PSScriptRoot/test/extensions"
}
} elseif ($Type -eq 'k8s-extension-private') {
$k8sExtensionPrivateVersion = $ENVCONFIG.extensionVersion.'k8s-extension-private'
Expand Down Expand Up @@ -74,7 +75,7 @@ if ($Type -eq 'k8s-extension') {
$testFilePaths = "$PSScriptRoot/test/configurations"
}

if ($CI) {
if ($ParallelCI) {
# This runs the tests in parallel during the CI pipline to speed up testing

Write-Host "Invoking Pester to run tests from '$testFilePath'..."
Expand Down Expand Up @@ -113,6 +114,14 @@ if ($CI) {
$failedJobs
throw "One or more tests failed"
}
} elseif ($CI) {
if ($Path) {
$testFilePath = "$PSScriptRoot/$Path"
}
Write-Host "Invoking Pester to run tests from '$testFilePath'..."
$testResult = Invoke-Pester $testFilePath -Passthru -Output Detailed
$testName = Split-Path $testFilePath –leaf
$testResult | Export-JUnitReport -Path "$testFileDirectory/$testName.xml"
} else {
if ($Path) {
Write-Host "Invoking Pester to run tests from '$PSScriptRoot/$Path'"
Expand Down
Loading

0 comments on commit b2eaf5e

Please sign in to comment.