diff --git a/eng/common/scripts/stress-testing/generate-scenario-matrix.ps1 b/eng/common/scripts/stress-testing/generate-scenario-matrix.ps1 index aba8be3451..1ddb05cd0c 100644 --- a/eng/common/scripts/stress-testing/generate-scenario-matrix.ps1 +++ b/eng/common/scripts/stress-testing/generate-scenario-matrix.ps1 @@ -39,12 +39,16 @@ function GenerateScenarioMatrix( $scenariosMatrix += $entry } - $valuesYaml = Get-Content -Raw (Join-Path (Split-Path $matrixFilePath) 'values.yaml') - $values = $valuesYaml | ConvertFrom-Yaml -Ordered - if (!$values) {$values = @{}} + $valuesConfig = Join-Path (Split-Path $matrixFilePath) 'values.yaml' + $values = [ordered]@{} + if (Test-Path $valuesConfig) { + $valuesYaml = Get-Content -Raw $valuesConfig + $values = $valuesYaml | ConvertFrom-Yaml -Ordered + if (!$values) {$values = @{}} - if ($values.ContainsKey('Scenarios')) { - throw "Please use matrix generation for stress test scenarios." + if ($values.ContainsKey('Scenarios')) { + throw "Please use matrix generation for stress test scenarios." + } } $values.scenarios = $scenariosMatrix diff --git a/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 b/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 index a082477779..0365bbb30c 100644 --- a/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 +++ b/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 @@ -248,7 +248,7 @@ function DeployStressPackage( } } } - $genVal.scenarios = foreach ($scenario in $genVal.scenarios) { + $genVal.scenarios = @( foreach ($scenario in $genVal.scenarios) { $dockerPath = Join-Path $pkg.Directory $scenario.image if ("image" -notin $scenario) { $dockerPath = $dockerFilePath @@ -257,7 +257,7 @@ function DeployStressPackage( $scenario.imageTag = $imageTag } $scenario - } + } ) $genVal | ConvertTo-Yaml | Out-File -FilePath $genValFile }