@@ -28,7 +28,7 @@ Tests creating new Batch account.
28
28
function Test-CreatesNewBatchAccount
29
29
{
30
30
# Setup
31
- $account = Get-BatchAccountName
31
+ $account = Get-BatchAccountName
32
32
$resourceGroup = Get-ResourceGroupName
33
33
$location = Get-BatchAccountProviderLocation
34
34
@@ -41,14 +41,14 @@ function Test-CreatesNewBatchAccount
41
41
$expected = Get-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup
42
42
43
43
# Assert
44
- Assert-AreEqual $expected.AccountName $actual.AccountName
44
+ Assert-AreEqual $expected.AccountName $actual.AccountName
45
45
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
46
- Assert-AreEqual $expected.Location $actual.Location
46
+ Assert-AreEqual $expected.Location $actual.Location
47
47
Assert-AreEqual $expected.Tags [0 ][" Name" ] $actual.Tags [0 ][" Name" ]
48
- Assert-AreEqual $expected.Tags [0 ][" Value" ] $actual.Tags [0 ][" Value" ]
49
- Assert-True { $actual.CoreQuota -gt 0 }
50
- Assert-True { $actual.PoolQuota -gt 0 }
51
- Assert-True { $actual.ActiveJobAndJobScheduleQuota -gt 0 }
48
+ Assert-AreEqual $expected.Tags [0 ][" Value" ] $actual.Tags [0 ][" Value" ]
49
+ Assert-True { $actual.CoreQuota -gt 0 }
50
+ Assert-True { $actual.PoolQuota -gt 0 }
51
+ Assert-True { $actual.ActiveJobAndJobScheduleQuota -gt 0 }
52
52
}
53
53
finally
54
54
{
@@ -64,7 +64,7 @@ Tests creating an account that already exists throws
64
64
function Test-CreateExistingBatchAccount
65
65
{
66
66
# Setup
67
- $account = Get-BatchAccountName
67
+ $account = Get-BatchAccountName
68
68
$resourceGroup = Get-ResourceGroupName
69
69
$location = Get-BatchAccountProviderLocation
70
70
@@ -91,36 +91,36 @@ Tests updating existing Batch account
91
91
function Test-UpdatesExistingBatchAccount
92
92
{
93
93
# Setup
94
- $account = Get-BatchAccountName
94
+ $account = Get-BatchAccountName
95
95
$resourceGroup = Get-ResourceGroupName
96
96
$location = Get-BatchAccountProviderLocation
97
97
98
- $tagName1 = " testtag1"
99
- $tagValue1 = " testval1"
100
- $tagName2 = " testtag2"
101
- $tagValue2 = " testval2"
98
+ $tagName1 = " testtag1"
99
+ $tagValue1 = " testval1"
100
+ $tagName2 = " testtag2"
101
+ $tagValue2 = " testval2"
102
102
103
103
try
104
104
{
105
105
New-AzureRmResourceGroup - Name $resourceGroup - Location $location
106
106
107
- # Test
107
+ # Test
108
108
$new = New-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup - Location $location - Tag @ {Name = $tagName1 ; Value = $tagValue1 }
109
- Assert-AreEqual 1 $new.Tags.Count
109
+ Assert-AreEqual 1 $new.Tags.Count
110
110
111
- # Update Tag
111
+ # Update Tag
112
112
$actual = Set-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup - Tag @ {Name = $tagName2 ; Value = $tagValue2 }
113
113
$expected = Get-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup
114
114
115
115
# Assert
116
- Assert-AreEqual $expected.AccountName $actual.AccountName
116
+ Assert-AreEqual $expected.AccountName $actual.AccountName
117
117
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
118
- Assert-AreEqual $expected.Location $actual.Location
119
- Assert-AreEqual 1 $expected.Tags.Count
120
- Assert-AreEqual $tagName2 $expected.Tags [0 ][" Name" ]
121
- Assert-AreEqual $tagValue2 $expected.Tags [0 ][" Value" ]
118
+ Assert-AreEqual $expected.Location $actual.Location
119
+ Assert-AreEqual 1 $expected.Tags.Count
120
+ Assert-AreEqual $tagName2 $expected.Tags [0 ][" Name" ]
121
+ Assert-AreEqual $tagValue2 $expected.Tags [0 ][" Value" ]
122
122
Assert-AreEqual $expected.Tags [0 ][" Name" ] $actual.Tags [0 ][" Name" ]
123
- Assert-AreEqual $expected.Tags [0 ][" Value" ] $actual.Tags [0 ][" Value" ]
123
+ Assert-AreEqual $expected.Tags [0 ][" Value" ] $actual.Tags [0 ][" Value" ]
124
124
}
125
125
finally
126
126
{
@@ -137,36 +137,36 @@ function Test-GetBatchAccountsUnderResourceGroups
137
137
{
138
138
# Setup
139
139
$resourceGroup1 = Get-ResourceGroupName
140
- $resourceGroup2 = Get-ResourceGroupName
141
- $account11 = Get-BatchAccountName
142
- $account12 = Get-BatchAccountName
143
- $account21 = Get-BatchAccountName
140
+ $resourceGroup2 = Get-ResourceGroupName
141
+ $account11 = Get-BatchAccountName
142
+ $account12 = Get-BatchAccountName
143
+ $account21 = Get-BatchAccountName
144
144
$location1 = Get-BatchAccountProviderLocation
145
- $location2 = Get-BatchAccountProviderLocation 4
146
- $location3 = Get-BatchAccountProviderLocation 7
145
+ $location2 = Get-BatchAccountProviderLocation 4
146
+ $location3 = Get-BatchAccountProviderLocation 7
147
147
148
148
try
149
149
{
150
150
New-AzureRmResourceGroup - Name $resourceGroup1 - Location $location1
151
- New-AzureRmResourceGroup - Name $resourceGroup2 - Location $location1
152
- New-AzureRmBatchAccount - Name $account11 - ResourceGroupName $resourceGroup1 - Location $location1
153
- New-AzureRmBatchAccount - Name $account12 - ResourceGroupName $resourceGroup1 - Location $location2
154
- New-AzureRmBatchAccount - Name $account21 - ResourceGroupName $resourceGroup2 - Location $location3
151
+ New-AzureRmResourceGroup - Name $resourceGroup2 - Location $location1
152
+ New-AzureRmBatchAccount - Name $account11 - ResourceGroupName $resourceGroup1 - Location $location1
153
+ New-AzureRmBatchAccount - Name $account12 - ResourceGroupName $resourceGroup1 - Location $location2
154
+ New-AzureRmBatchAccount - Name $account21 - ResourceGroupName $resourceGroup2 - Location $location3
155
155
156
156
# Test
157
- $allAccounts = Get-AzureRmBatchAccount | Where-Object {$_.ResourceGroupName -eq $resourceGroup1 -or $_.ResourceGroupName -eq $resourceGroup2 }
158
- $resourceGroup1Accounts = Get-AzureRmBatchAccount - ResourceGroupName $resourceGroup1
157
+ $allAccounts = Get-AzureRmBatchAccount | Where-Object {$_.ResourceGroupName -eq $resourceGroup1 -or $_.ResourceGroupName -eq $resourceGroup2 }
158
+ $resourceGroup1Accounts = Get-AzureRmBatchAccount - ResourceGroupName $resourceGroup1
159
159
160
- # Assert
161
- Assert-AreEqual 3 $allAccounts.Count
162
- Assert-AreEqual 2 $resourceGroup1Accounts.Count
163
- Assert-AreEqual 2 ($resourceGroup1Accounts | Where-Object {$_.ResourceGroupName -eq $resourceGroup1 }).Count
160
+ # Assert
161
+ Assert-AreEqual 3 $allAccounts.Count
162
+ Assert-AreEqual 2 $resourceGroup1Accounts.Count
163
+ Assert-AreEqual 2 ($resourceGroup1Accounts | Where-Object {$_.ResourceGroupName -eq $resourceGroup1 }).Count
164
164
}
165
165
finally
166
166
{
167
167
# Cleanup
168
- Clean - BatchAccount $account11 $resourceGroup1
169
- Clean - BatchAccountAndResourceGroup $account12 $resourceGroup1
168
+ Clean - BatchAccount $account11 $resourceGroup1
169
+ Clean - BatchAccountAndResourceGroup $account12 $resourceGroup1
170
170
Clean - BatchAccountAndResourceGroup $account21 $resourceGroup2
171
171
}
172
172
}
@@ -180,28 +180,28 @@ function Test-CreateAndRemoveBatchAccountViaPiping
180
180
{
181
181
# Setup
182
182
$account1 = Get-BatchAccountName
183
- $account2 = Get-BatchAccountName
183
+ $account2 = Get-BatchAccountName
184
184
$resourceGroup = Get-ResourceGroupName
185
185
$location1 = Get-BatchAccountProviderLocation
186
- $location2 = Get-BatchAccountProviderLocation 4
187
-
188
- try
189
- {
190
- New-AzureRmResourceGroup - Name $resourceGroup - Location $location1
191
-
192
- # Test
193
- New-AzureRmBatchAccount - Name $account1 - ResourceGroupName $resourceGroup - Location $location1
194
- New-AzureRmBatchAccount - Name $account2 - ResourceGroupName $resourceGroup - Location $location2
195
- Get-AzureRmBatchAccount | where {$_.AccountName -eq $account1 -or $_.AccountName -eq $account2 } | Remove-AzureRmBatchAccount - Force
196
-
197
- # Assert
198
- Assert-Throws { Get-AzureRmBatchAccount - Name $account1 }
199
- Assert-Throws { Get-AzureRmBatchAccount - Name $account2 }
200
- }
201
- finally
202
- {
203
- Clean - ResourceGroup $resourceGroup
204
- }
186
+ $location2 = Get-BatchAccountProviderLocation 4
187
+
188
+ try
189
+ {
190
+ New-AzureRmResourceGroup - Name $resourceGroup - Location $location1
191
+
192
+ # Test
193
+ New-AzureRmBatchAccount - Name $account1 - ResourceGroupName $resourceGroup - Location $location1
194
+ New-AzureRmBatchAccount - Name $account2 - ResourceGroupName $resourceGroup - Location $location2
195
+ Get-AzureRmBatchAccount | where {$_.AccountName -eq $account1 -or $_.AccountName -eq $account2 } | Remove-AzureRmBatchAccount - Force
196
+
197
+ # Assert
198
+ Assert-Throws { Get-AzureRmBatchAccount - Name $account1 }
199
+ Assert-Throws { Get-AzureRmBatchAccount - Name $account2 }
200
+ }
201
+ finally
202
+ {
203
+ Clean - ResourceGroup $resourceGroup
204
+ }
205
205
}
206
206
207
207
<#
@@ -211,7 +211,7 @@ Tests getting/setting Batch account keys
211
211
function Test-BatchAccountKeys
212
212
{
213
213
# Setup
214
- $account = Get-BatchAccountName
214
+ $account = Get-BatchAccountName
215
215
$resourceGroup = Get-ResourceGroupName
216
216
$location = Get-BatchAccountProviderLocation
217
217
@@ -221,25 +221,25 @@ function Test-BatchAccountKeys
221
221
222
222
# Test
223
223
$new = New-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup - Location $location - Tag @ {Name = " testtag" ; Value = " testval" }
224
- $originalKeys = Get-AzureRmBatchAccountKeys - Name $account - ResourceGroupName $resourceGroup
225
- $originalPrimaryKey = $originalKeys.PrimaryAccountKey
226
- $originalSecondaryKey = $originalKeys.SecondaryAccountKey
227
- $newPrimary = New-AzureRmBatchAccountKey - Name $account - ResourceGroupName $resourceGroup - KeyType Primary
228
- $newSecondary = New-AzureRmBatchAccountKey - Name $account - ResourceGroupName $resourceGroup - KeyType Secondary
224
+ $originalKeys = Get-AzureRmBatchAccountKeys - Name $account - ResourceGroupName $resourceGroup
225
+ $originalPrimaryKey = $originalKeys.PrimaryAccountKey
226
+ $originalSecondaryKey = $originalKeys.SecondaryAccountKey
227
+ $newPrimary = New-AzureRmBatchAccountKey - Name $account - ResourceGroupName $resourceGroup - KeyType Primary
228
+ $newSecondary = New-AzureRmBatchAccountKey - Name $account - ResourceGroupName $resourceGroup - KeyType Secondary
229
229
$finalKeys = Get-AzureRmBatchAccountKeys - Name $account - ResourceGroupName $resourceGroup
230
- $getAccountResult = Get-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup
230
+ $getAccountResult = Get-AzureRmBatchAccount - Name $account - ResourceGroupName $resourceGroup
231
231
232
232
# Assert
233
- Assert-AreEqual $null $new.PrimaryAccountKey
233
+ Assert-AreEqual $null $new.PrimaryAccountKey
234
234
Assert-AreEqual $null $new.SecondaryAccountKey
235
- Assert-AreEqual $originalSecondaryKey $newPrimary.SecondaryAccountKey
236
- Assert-AreEqual $newPrimary.PrimaryAccountKey $newSecondary.PrimaryAccountKey
237
- Assert-AreEqual $newPrimary.PrimaryAccountKey $finalKeys.PrimaryAccountKey
238
- Assert-AreEqual $newSecondary.SecondaryAccountKey $finalKeys.SecondaryAccountKey
239
- Assert-AreNotEqual $originalPrimaryKey $newPrimary.PrimaryAccountKey
240
- Assert-AreNotEqual $originalSecondaryKey $newSecondary.SecondaryAccountKey
241
- Assert-AreEqual $null $getAccountResult.PrimaryAccountKey
242
- Assert-AreEqual $null $getAccountResult.SecondaryAccountKey
235
+ Assert-AreEqual $originalSecondaryKey $newPrimary.SecondaryAccountKey
236
+ Assert-AreEqual $newPrimary.PrimaryAccountKey $newSecondary.PrimaryAccountKey
237
+ Assert-AreEqual $newPrimary.PrimaryAccountKey $finalKeys.PrimaryAccountKey
238
+ Assert-AreEqual $newSecondary.SecondaryAccountKey $finalKeys.SecondaryAccountKey
239
+ Assert-AreNotEqual $originalPrimaryKey $newPrimary.PrimaryAccountKey
240
+ Assert-AreNotEqual $originalSecondaryKey $newSecondary.SecondaryAccountKey
241
+ Assert-AreEqual $null $getAccountResult.PrimaryAccountKey
242
+ Assert-AreEqual $null $getAccountResult.SecondaryAccountKey
243
243
}
244
244
finally
245
245
{
0 commit comments