Skip to content

Commit 3a74c37

Browse files
azure-sdkbenbp
andauthored
Use named parameter arguments and explicitly set switch argument values (Azure#25818)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
1 parent 6fc7472 commit 3a74c37

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

eng/common/scripts/stress-testing/find-all-stress-packages.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class StressTestPackageInfo {
99
[string]$ReleaseName
1010
}
1111

12-
function FindStressPackages([string]$directory, [hashtable]$filters = @{}, [boolean]$CI = $false) {
12+
function FindStressPackages([string]$directory, [hashtable]$filters = @{}, [switch]$CI) {
1313
# Bare minimum filter for stress tests
1414
$filters['stressTest'] = 'true'
1515

@@ -18,7 +18,7 @@ function FindStressPackages([string]$directory, [hashtable]$filters = @{}, [bool
1818
foreach ($chartFile in $chartFiles) {
1919
$chart = ParseChart $chartFile
2020
if (matchesAnnotations $chart $filters) {
21-
$packages += NewStressTestPackageInfo $chart $chartFile $CI
21+
$packages += NewStressTestPackageInfo -chart $chart -chartFile $chartFile -CI:$CI
2222
}
2323
}
2424

@@ -39,7 +39,7 @@ function MatchesAnnotations([hashtable]$chart, [hashtable]$filters) {
3939
return $true
4040
}
4141

42-
function NewStressTestPackageInfo([hashtable]$chart, [System.IO.FileInfo]$chartFile, [boolean]$CI) {
42+
function NewStressTestPackageInfo([hashtable]$chart, [System.IO.FileInfo]$chartFile, [switch]$CI) {
4343
$namespace = if ($CI) {
4444
$chart.annotations.namespace
4545
} else {

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function DeployStressTests(
6363
[string]$deployId = 'local',
6464
[switch]$login,
6565
[string]$subscription = '',
66-
[switch]$ci
66+
[switch]$CI
6767
) {
6868
if ($environment -eq 'test') {
6969
if ($clusterGroup -or $subscription) {
@@ -89,19 +89,25 @@ function DeployStressTests(
8989
if (!$clusterGroup -or !$subscription) {
9090
throw "clusterGroup and subscription parameters must be specified when logging into an environment that is not test or prod."
9191
}
92-
Login $subscription $clusterGroup $pushImages
92+
Login -subscription $subscription -clusterGroup $clusterGroup -pushImages:$pushImages
9393
}
9494

9595
RunOrExitOnFailure helm repo add stress-test-charts https://stresstestcharts.blob.core.windows.net/helm/
9696
Run helm repo update
9797
if ($LASTEXITCODE) { return $LASTEXITCODE }
9898

99-
$pkgs = FindStressPackages $searchDirectory $filters $CI
99+
$pkgs = FindStressPackages -directory $searchDirectory -filters $filters -CI:$CI
100100
Write-Host "" "Found $($pkgs.Length) stress test packages:"
101101
Write-Host $pkgs.Directory ""
102102
foreach ($pkg in $pkgs) {
103103
Write-Host "Deploying stress test at '$($pkg.Directory)'"
104-
DeployStressPackage $pkg $deployId $environment $repository $pushImages $login
104+
DeployStressPackage `
105+
-pkg $pkg `
106+
-deployId $deployId `
107+
-environment $environment `
108+
-repositoryBase $repository `
109+
-pushImages:$pushImages `
110+
-login:$login
105111
}
106112

107113
Write-Host "Releases deployed by $deployId"

0 commit comments

Comments
 (0)