Skip to content

Commit b019594

Browse files
authored
[stress testing] Improve scenario matrix edge case handling (#4504)
1 parent 9800a47 commit b019594

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

eng/common/scripts/stress-testing/generate-scenario-matrix.ps1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,16 @@ function GenerateScenarioMatrix(
3939
$scenariosMatrix += $entry
4040
}
4141

42-
$valuesYaml = Get-Content -Raw (Join-Path (Split-Path $matrixFilePath) 'values.yaml')
43-
$values = $valuesYaml | ConvertFrom-Yaml -Ordered
44-
if (!$values) {$values = @{}}
42+
$valuesConfig = Join-Path (Split-Path $matrixFilePath) 'values.yaml'
43+
$values = [ordered]@{}
44+
if (Test-Path $valuesConfig) {
45+
$valuesYaml = Get-Content -Raw $valuesConfig
46+
$values = $valuesYaml | ConvertFrom-Yaml -Ordered
47+
if (!$values) {$values = @{}}
4548

46-
if ($values.ContainsKey('Scenarios')) {
47-
throw "Please use matrix generation for stress test scenarios."
49+
if ($values.ContainsKey('Scenarios')) {
50+
throw "Please use matrix generation for stress test scenarios."
51+
}
4852
}
4953

5054
$values.scenarios = $scenariosMatrix

eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ function DeployStressPackage(
248248
}
249249
}
250250
}
251-
$genVal.scenarios = foreach ($scenario in $genVal.scenarios) {
251+
$genVal.scenarios = @( foreach ($scenario in $genVal.scenarios) {
252252
$dockerPath = Join-Path $pkg.Directory $scenario.image
253253
if ("image" -notin $scenario) {
254254
$dockerPath = $dockerFilePath
@@ -257,7 +257,7 @@ function DeployStressPackage(
257257
$scenario.imageTag = $imageTag
258258
}
259259
$scenario
260-
}
260+
} )
261261

262262
$genVal | ConvertTo-Yaml | Out-File -FilePath $genValFile
263263
}

0 commit comments

Comments
 (0)